File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -24,19 +24,18 @@ class AlarmManager {
2424
2525 async checkSync ( ) {
2626 const accounts = await BrowserAccountStorage . getAllAccounts ( )
27- const promises = [ ]
2827 for ( let accountId of accounts ) {
2928 const account = await Account . get ( accountId )
3029 const data = account . getData ( )
3130 const lastSync = data . lastSync || 0
3231 const interval = data . syncInterval || DEFAULT_SYNC_INTERVAL
3332 if ( data . scheduled ) {
34- promises . push ( this . ctl . scheduleSync ( accountId ) )
33+ await this . ctl . scheduleSync ( accountId )
3534 continue
3635 }
3736 if ( data . error && data . errorCount > 1 ) {
3837 if ( Date . now ( ) > this . getBackoffInterval ( interval , data . errorCount , lastSync ) + lastSync ) {
39- promises . push ( this . ctl . scheduleSync ( accountId ) )
38+ await this . ctl . scheduleSync ( accountId )
4039 continue
4140 }
4241 continue
@@ -45,10 +44,9 @@ class AlarmManager {
4544 Date . now ( ) >
4645 interval * 1000 * 60 + lastSync
4746 ) {
48- promises . push ( this . ctl . scheduleSync ( accountId ) )
47+ await this . ctl . scheduleSync ( accountId )
4948 }
5049 }
51- await Promise . all ( promises )
5250 }
5351
5452 /**
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ class AlarmManager {
3636 const lastSync = data . lastSync || 0
3737 const interval = data . syncInterval || DEFAULT_SYNC_INTERVAL
3838 if ( data . scheduled ) {
39- this . ctl . scheduleSync ( accountId )
39+ await this . ctl . scheduleSync ( accountId )
4040 continue
4141 }
4242 if ( data . error && data . errorCount > 1 ) {
4343 if ( Date . now ( ) > this . getBackoffInterval ( interval , data . errorCount , lastSync ) + lastSync ) {
44- this . ctl . scheduleSync ( accountId )
44+ await this . ctl . scheduleSync ( accountId )
4545 continue
4646 }
4747 continue
@@ -50,7 +50,7 @@ class AlarmManager {
5050 Date . now ( ) >
5151 interval * 1000 * 60 + data . lastSync
5252 ) {
53- this . ctl . scheduleSync ( accountId )
53+ await this . ctl . scheduleSync ( accountId )
5454 }
5555 }
5656 }
@@ -145,6 +145,7 @@ export default class NativeController {
145145 if ( this . schedule [ accountId ] ) {
146146 clearTimeout ( this . schedule [ accountId ] )
147147 }
148+ console . log ( 'scheduleSync: setting a timeout in ms :' , INACTIVITY_TIMEOUT )
148149 this . schedule [ accountId ] = setTimeout (
149150 ( ) => this . scheduleSync ( accountId ) ,
150151 INACTIVITY_TIMEOUT
You can’t perform that action at this time.
0 commit comments