Skip to content

Commit

Permalink
Address PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexs-mparticle committed Oct 6, 2023
1 parent 18d8956 commit 45046a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/batchUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,13 @@ export class BatchUploader {
this.batchesQueuedForProcessing.unshift(...batchesThatDidNotUpload);
}

if (this.offlineStorageEnabled && this.batchVault) {
// Update Offline Storage with current state of batch queue
if (!useBeacon && this.offlineStorageEnabled && this.batchVault) {
// Note: since beacon is "Fire and forget" it will empty `batchesThatDidNotUplod`
// regardless of whether the batches were successfully uploaded or not. We should
// therefore NOT overwrite Offline Storage when beacon returns, so that we can retry
// uploading saved batches at a later time. Batches should only be removed from
// Local Storage once we can confirm they are successfully uploaded
// Store current queue in case there is anything that hasn't uploaded yet
this.batchVault.store(this.batchesQueuedForProcessing);

Expand Down

0 comments on commit 45046a8

Please sign in to comment.