mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-29 04:17:41 +02:00
[PM-6426] Using the getUpperBoundDelayInMinutes method to handle setting stepped alarms and setTimeout fallbacks
This commit is contained in:
parent
478b8e6f13
commit
2ae0296b2e
@ -64,7 +64,7 @@ export class BrowserTaskSchedulerServiceImplementation
|
||||
|
||||
// If the delay is less than a minute, we want to attempt to trigger the task through a setTimeout.
|
||||
// The alarm previously scheduled will be used as a backup in case the setTimeout fails.
|
||||
if (delayInMinutes < 1) {
|
||||
if (delayInMinutes < this.getUpperBoundDelayInMinutes(delayInMinutes)) {
|
||||
return globalThis.setTimeout(async () => {
|
||||
await this.clearScheduledAlarm(taskName);
|
||||
await this.triggerTask(taskName);
|
||||
@ -93,7 +93,7 @@ export class BrowserTaskSchedulerServiceImplementation
|
||||
? initialDelayInMs / 1000 / 60
|
||||
: intervalInMinutes;
|
||||
|
||||
if (intervalInMinutes < 1) {
|
||||
if (intervalInMinutes < this.getUpperBoundDelayInMinutes(intervalInMinutes)) {
|
||||
return this.setupSteppedIntervalAlarms(taskName, intervalInMs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user