File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
packages/remote-config/src Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -406,9 +406,11 @@ export class RealtimeHandler {
406
406
407
407
const timeTillFetchSeconds = this . getRandomInt ( 4 ) ;
408
408
const timeTillFetchInMiliseconds = timeTillFetchSeconds * 1000 ;
409
- setTimeout ( async ( ) => {
410
- await this . fetchLatestConfig ( remainingAttempts , targetVersion ) ;
411
- } , timeTillFetchInMiliseconds ) ;
409
+
410
+ await new Promise ( resolve =>
411
+ setTimeout ( resolve , timeTillFetchInMiliseconds )
412
+ ) ;
413
+ await this . fetchLatestConfig ( remainingAttempts , targetVersion ) ;
412
414
}
413
415
414
416
private async handleNotifications (
@@ -633,9 +635,8 @@ export class RealtimeHandler {
633
635
}
634
636
if ( this . httpRetriesRemaining > 0 ) {
635
637
this . httpRetriesRemaining -- ;
636
- setTimeout ( async ( ) => {
637
- await this . beginRealtimeHttpStream ( ) ;
638
- } , delayMillis ) ;
638
+ await new Promise ( resolve => setTimeout ( resolve , delayMillis ) ) ;
639
+ await this . beginRealtimeHttpStream ( ) ;
639
640
} else if ( ! this . isInBackground ) {
640
641
const error = ERROR_FACTORY . create ( ErrorCode . CONFIG_UPDATE_STREAM_ERROR , {
641
642
originalErrorMessage :
Original file line number Diff line number Diff line change @@ -192,10 +192,6 @@ export abstract class Storage {
192
192
return this . get < RealtimeBackoffMetadata > ( 'realtime_backoff_metadata' ) ;
193
193
}
194
194
195
- getLastKnownTemplateVersion ( ) : Promise < number | undefined > {
196
- return this . get < number > ( 'last_known_template_version' ) ;
197
- }
198
-
199
195
setRealtimeBackoffMetadata (
200
196
realtimeMetadata : RealtimeBackoffMetadata
201
197
) : Promise < void > {
@@ -205,6 +201,10 @@ export abstract class Storage {
205
201
) ;
206
202
}
207
203
204
+ getLastKnownTemplateVersion ( ) : Promise < number | undefined > {
205
+ return this . get < number > ( 'last_known_template_version' ) ;
206
+ }
207
+
208
208
setLastKnownTemplateVersion ( version : number ) : Promise < void > {
209
209
return this . set < number > ( 'last_known_template_version' , version ) ;
210
210
}
You can’t perform that action at this time.
0 commit comments