-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
104 additions
and
67 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "https://deno.land/std@0.201.0/datetime/constants.ts"; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env -S deno run --unstable | ||
|
||
const kv = await Deno.openKv(); | ||
try { | ||
const iter = kv.list({ prefix: [] }); | ||
for await (const entry of iter) { | ||
console.dir(entry, { depth: Infinity, iterableLimit: Infinity }); | ||
} | ||
} finally { | ||
kv.close(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const controller = new AbortController(); | ||
Deno.addSignalListener("SIGINT", function abort() { | ||
queueMicrotask(() => { | ||
Deno.addSignalListener("SIGINT", () => Deno.exit(0x82)); | ||
Deno.removeSignalListener("SIGINT", abort); | ||
}); | ||
controller.abort(new DOMException("Interrupted.", "AbortError")); | ||
}); | ||
export const signal = controller.signal; |
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,10 +1,28 @@ | ||
#!/usr/bin/env -S deno run --allow-read=dist,index.html,robots.txt --allow-net=0.0.0.0,graphql.fauna.com --allow-env=FAUNA_SECRET | ||
#!/usr/bin/env -S deno run --unstable --allow-read=dist,index.html,robots.txt --allow-net=0.0.0.0,graphql.fauna.com --allow-env=FAUNA_SECRET | ||
|
||
import { onError, toStdHandler } from "./handler.ts"; | ||
import { handler } from "./server.ts"; | ||
import { signal } from "./interrupt_signal.ts"; | ||
import { getHandler } from "./server.ts"; | ||
|
||
const server = Deno.serve({ | ||
handler: toStdHandler(handler), | ||
onError, | ||
}); | ||
await server.finished; | ||
const kv = await Deno.openKv(); | ||
try { | ||
const server = Deno.serve({ | ||
signal, | ||
handler: toStdHandler(getHandler(kv)), | ||
onError, | ||
}); | ||
await Promise.all([ | ||
server.finished, | ||
(async () => { | ||
const iter = kv.list({ prefix: ["expire"], end: ["expire", Date.now()] }); | ||
for await (const { key } of iter) { | ||
kv.atomic() | ||
.delete(key) | ||
.delete(key.slice(2)) | ||
.commit(); | ||
} | ||
})(), | ||
]); | ||
} finally { | ||
kv.close(); | ||
} |
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