diff --git a/packages/workbox-background-sync/src/lib/QueueDb.ts b/packages/workbox-background-sync/src/lib/QueueDb.ts index 19797c2ba..62517959b 100644 --- a/packages/workbox-background-sync/src/lib/QueueDb.ts +++ b/packages/workbox-background-sync/src/lib/QueueDb.ts @@ -56,7 +56,9 @@ export class QueueDb { */ async addEntry(entry: UnidentifiedQueueStoreEntry): Promise { 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; } /** diff --git a/packages/workbox-expiration/src/models/CacheTimestampsModel.ts b/packages/workbox-expiration/src/models/CacheTimestampsModel.ts index c235a8297..3b5fe0c68 100644 --- a/packages/workbox-expiration/src/models/CacheTimestampsModel.ts +++ b/packages/workbox-expiration/src/models/CacheTimestampsModel.ts @@ -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; } /**