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 {
406406
407407 const timeTillFetchSeconds = this . getRandomInt ( 4 ) ;
408408 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 ) ;
412414 }
413415
414416 private async handleNotifications (
@@ -633,9 +635,8 @@ export class RealtimeHandler {
633635 }
634636 if ( this . httpRetriesRemaining > 0 ) {
635637 this . httpRetriesRemaining -- ;
636- setTimeout ( async ( ) => {
637- await this . beginRealtimeHttpStream ( ) ;
638- } , delayMillis ) ;
638+ await new Promise ( resolve => setTimeout ( resolve , delayMillis ) ) ;
639+ await this . beginRealtimeHttpStream ( ) ;
639640 } else if ( ! this . isInBackground ) {
640641 const error = ERROR_FACTORY . create ( ErrorCode . CONFIG_UPDATE_STREAM_ERROR , {
641642 originalErrorMessage :
Original file line number Diff line number Diff line change @@ -192,10 +192,6 @@ export abstract class Storage {
192192 return this . get < RealtimeBackoffMetadata > ( 'realtime_backoff_metadata' ) ;
193193 }
194194
195- getLastKnownTemplateVersion ( ) : Promise < number | undefined > {
196- return this . get < number > ( 'last_known_template_version' ) ;
197- }
198-
199195 setRealtimeBackoffMetadata (
200196 realtimeMetadata : RealtimeBackoffMetadata
201197 ) : Promise < void > {
@@ -205,6 +201,10 @@ export abstract class Storage {
205201 ) ;
206202 }
207203
204+ getLastKnownTemplateVersion ( ) : Promise < number | undefined > {
205+ return this . get < number > ( 'last_known_template_version' ) ;
206+ }
207+
208208 setLastKnownTemplateVersion ( version : number ) : Promise < void > {
209209 return this . set < number > ( 'last_known_template_version' , version ) ;
210210 }
You can’t perform that action at this time.
0 commit comments