Skip to content

Commit

Permalink
changing durability to relaxed (#2934)
Browse files Browse the repository at this point in the history
* changing durability to be relaxed

* fix bug

* add QueueDB add to be durability relaxed
  • Loading branch information
tropicadri committed Sep 7, 2021
1 parent 43d56d5 commit 669df58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/workbox-background-sync/src/lib/QueueDb.ts
Expand Up @@ -56,7 +56,9 @@ export class QueueDb {
*/
async addEntry(entry: UnidentifiedQueueStoreEntry): Promise<void> {
const db = await this.getDb();
await db.add(REQUEST_OBJECT_STORE_NAME, entry as QueueStoreEntry);
const tx = db.transaction(REQUEST_OBJECT_STORE_NAME, 'readwrite', { durability: 'relaxed' });
await tx.store.add(entry as QueueStoreEntry);
await tx.done;
}

/**
Expand Down
Expand Up @@ -111,7 +111,9 @@ class CacheTimestampsModel {
id: this._getId(url),
};
const db = await this.getDb();
await db.put(CACHE_OBJECT_STORE, entry);
const tx = db.transaction(CACHE_OBJECT_STORE, 'readwrite', {durability: 'relaxed'});
await tx.store.put(entry);
await tx.done;
}

/**
Expand Down

0 comments on commit 669df58

Please sign in to comment.