-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue in IndexedDB payload driver, other tests.
- Loading branch information
Showing
3 changed files
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { delay } from "https://deno.land/[email protected]/async/delay.ts"; | ||
import { concat, deferred } from "../../../../deps.ts"; | ||
import { ValidationError, WillowError } from "../../../errors.ts"; | ||
import { Payload, PayloadScheme } from "../../types.ts"; | ||
|
@@ -198,12 +199,12 @@ export class PayloadDriverIndexedDb<PayloadDigest> | |
PAYLOAD_STORE, | ||
); | ||
|
||
const request = payloadStore.put(bytes, key); | ||
|
||
const didSet = deferred< | ||
{ digest: PayloadDigest; length: bigint; payload: Payload } | ||
>(); | ||
|
||
const request = payloadStore.put(bytes, key); | ||
|
||
request.onsuccess = () => { | ||
didSet.resolve({ | ||
digest, | ||
|
@@ -261,20 +262,20 @@ export class PayloadDriverIndexedDb<PayloadDigest> | |
|
||
const finalBytes = concat(existingBytes, receivedBytes); | ||
|
||
const payloadStore2 = db.transaction([PAYLOAD_STORE], "readwrite") | ||
const digest = await this.payloadScheme.fromBytes( | ||
new Uint8Array(finalBytes), | ||
); | ||
|
||
const payloadStore = db.transaction([PAYLOAD_STORE], "readwrite") | ||
.objectStore( | ||
PAYLOAD_STORE, | ||
); | ||
|
||
const request = payloadStore2.put(finalBytes, key); | ||
|
||
const didSet = deferred< | ||
{ digest: PayloadDigest; length: bigint } | ||
>(); | ||
|
||
const digest = await this.payloadScheme.fromBytes( | ||
new Uint8Array(finalBytes), | ||
); | ||
const request = payloadStore.put(finalBytes, key); | ||
|
||
request.onsuccess = () => { | ||
didSet.resolve({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters