Skip to content

Commit b8e72b6

Browse files
committed
Attend to review comments
1 parent c5ad983 commit b8e72b6

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

glean/src/core/upload/index.ts

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)