aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-16 05:36:43 -0700
committerAdam Soltys <[email protected]>2026-09-16 05:36:43 -0700
commit5f21055178875821007aec25f32ef4168b24cbbc (patch)
treec6259e7f0e9494a4f1f344444dee117578ba62a7 /lib
parentd6d926b033e1430844b268a3392729c5c68ea389 (diff)
downloadcoinos-server-5f21055178875821007aec25f32ef4168b24cbbc.tar.gz
coinos-server-5f21055178875821007aec25f32ef4168b24cbbc.zip
lnurl: expire payRequest callback ids after seven days
A callback id is read once, minutes after the metadata request, and never again, but the pointer keys were written without an expiry and had grown to roughly 45% of all keys in the main database. Let the set helper take a TTL and apply one to both lnurl pointer keys. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/db.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/db.ts b/lib/db.ts
index 4e746fa2..e03fb810 100644
--- a/lib/db.ts
+++ b/lib/db.ts
@@ -130,9 +130,9 @@ export const g = async (k) => {
}
};
-export const s = (k, v) => {
+export const s = (k, v, ttl?: number) => {
if (k === "user:null" || k === "user:undefined") fail("null user");
- db.set(k, JSON.stringify(v));
+ db.set(k, JSON.stringify(v), ttl ? { EX: ttl } : undefined);
};
export const ga = async (k) => {