Skip to content

Commit

Permalink
fix: revert the localstorage clearing strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Mar 19, 2024
1 parent 9af8ae0 commit 52e01b7
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ class RetryQueue implements IQueue<QueueItemData> {
(globalThis as typeof window).setTimeout(() => {
try {
store.remove(entry);

// clear the next entry
if (entryIdx + 1 < queueEntryKeys.length) {
this.removeStorageEntry(store, entryIdx + 1, backoff);
}
} catch (err) {
const storageBusyErr = 'NS_ERROR_STORAGE_BUSY';
const isLocalStorageBusy =
Expand All @@ -654,11 +659,11 @@ class RetryQueue implements IQueue<QueueItemData> {
} else {
this.logger?.error(RETRY_QUEUE_ENTRY_REMOVE_ERROR(RETRY_QUEUE, entry, attempt), err);
}
}

// clear the next entry
if (attempt === maxAttempts && entryIdx + 1 < queueEntryKeys.length) {
this.removeStorageEntry(store, entryIdx + 1, backoff);
// clear the next entry after we've exhausted our attempts
if (attempt === maxAttempts && entryIdx + 1 < queueEntryKeys.length) {
this.removeStorageEntry(store, entryIdx + 1, backoff);
}
}
}, backoff);
}
Expand Down

0 comments on commit 52e01b7

Please sign in to comment.