mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
close deno kv on policy worker close
This commit is contained in:
parent
b613334312
commit
3462df8e6a
1 changed files with 4 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ interface PolicyInit {
|
|||
|
||||
export class CustomPolicy implements NPolicy {
|
||||
private policy: NPolicy = new ReadOnlyPolicy();
|
||||
registryKv: Deno.Kv | undefined;
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
async call(event: NostrEvent, signal?: AbortSignal): Promise<NostrRelayOK> {
|
||||
|
|
@ -62,7 +63,8 @@ export class CustomPolicy implements NPolicy {
|
|||
});
|
||||
}
|
||||
}
|
||||
const registry = new PolicyRegistry({ store, antiDuplicationPolicyStore: await Deno.openKv() });
|
||||
this.registryKv = await Deno.openKv();
|
||||
const registry = new PolicyRegistry({ store, antiDuplicationPolicyStore: this.registryKv });
|
||||
const event = await store
|
||||
.query([{ kinds: [11984], authors: [await conf.signer.getPublicKey()] }])
|
||||
.then((results) => results[0]);
|
||||
|
|
@ -87,6 +89,7 @@ export class CustomPolicy implements NPolicy {
|
|||
}
|
||||
|
||||
close() {
|
||||
this.registryKv?.close();
|
||||
self.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue