fix: "uncaught" errors caused by kvstorage
Massimo Melina committed
Jul 4, 2024 at 01:02 UTC
f9a99240f876f7f7f8c1674b558f9d6fa55adbbc
2 files changed
+2
-2
package.json
+1
-1
@@ -71,7 +71,7 @@
71
"dependencies": {
72
"@koa/router": "^12.0.1",
73
"@node-rs/crc32": "^1.6.0",
74
- "@rejetto/kvstorage": "^0.12.1",
74
+ "@rejetto/kvstorage": "^0.12.2",
75
"acme-client": "^5.3.1",
76
"buffer-crc32": "^0.2.13",
77
"fast-glob": "^3.2.7",
src/ips.ts
+1
-1
@@ -15,7 +15,7 @@ export const ips = new KvStorage({
15
onProcessExit(() => ips.flush())
16
17
export const trackIpsMw: Middleware = async (ctx, next) => {
18
- if (trackIps.get() && !isLocalHost(ctx))
18
+ if (ips.isOpen() && !isLocalHost(ctx))
19
ips.put(ctx.ip, { ts: new Date, country: ctx.state.connection.country })
20
await next()
21
}