@@ -108,37 +108,34 @@ class PingUploader implements PingsDatabaseObserver {
108108 * @param ping The ping to enqueue.
109109 */
110110 private enqueuePing ( ping : QueuedPing ) : void {
111- let isDuplicate = false ;
112111 for ( const queuedPing of this . processing ) {
113112 if ( queuedPing . identifier === ping . identifier ) {
114- isDuplicate = true ;
113+ return ;
115114 }
116115 }
117116
118- if ( ! isDuplicate ) {
119- // Add the ping to the list of pings being processsed.
120- this . processing . push ( ping ) ;
121- // Dispatch the uploading task.
122- this . dispatcher . launch ( async ( ) : Promise < void > => {
123- const status = await this . attemptPingUpload ( ping ) ;
124- const shouldRetry = await this . processPingUploadResponse ( ping . identifier , status ) ;
117+ // Add the ping to the list of pings being processsed.
118+ this . processing . push ( ping ) ;
119+ // Dispatch the uploading task.
120+ this . dispatcher . launch ( async ( ) : Promise < void > => {
121+ const status = await this . attemptPingUpload ( ping ) ;
122+ const shouldRetry = await this . processPingUploadResponse ( ping . identifier , status ) ;
125123
126- if ( shouldRetry ) {
127- ping . retries ++ ;
128- this . enqueuePing ( ping ) ;
129- }
124+ if ( shouldRetry ) {
125+ ping . retries ++ ;
126+ this . enqueuePing ( ping ) ;
127+ }
130128
131- if ( ping . retries >= this . policy . maxRecoverableFailures ) {
132- log (
133- LOG_TAG ,
134- `Reached maximum recoverable failures for ping "${ JSON . stringify ( ping . name ) } ". You are done.` ,
135- LoggingLevel . Info
136- ) ;
137- this . dispatcher . stop ( ) ;
138- ping . retries = 0 ;
139- }
140- } ) ;
141- }
129+ if ( ping . retries >= this . policy . maxRecoverableFailures ) {
130+ log (
131+ LOG_TAG ,
132+ `Reached maximum recoverable failures for ping "${ JSON . stringify ( ping . name ) } ". You are done.` ,
133+ LoggingLevel . Info
134+ ) ;
135+ this . dispatcher . stop ( ) ;
136+ ping . retries = 0 ;
137+ }
138+ } ) ;
142139 }
143140
144141 /**
0 commit comments