aboutsummaryrefslogtreecommitdiffstats
path: root/lib/db.js
diff options
context:
space:
mode:
authorJohn Barratt <[email protected]>2023-02-28 13:55:59 -0800
committerJohn Barratt <[email protected]>2023-02-28 13:55:59 -0800
commite47d50a443f0a396321716a506e1df325dd4a1fb (patch)
tree1c010c5970e9cbfbf8671e6f00a97d6518446fdd /lib/db.js
parent58e996a4ac227162f171e84530fe898cb504e045 (diff)
parente4702b4d13e4d966d735c2ba4657e10d7c436a57 (diff)
downloadcoinos-server-e47d50a443f0a396321716a506e1df325dd4a1fb.tar.gz
coinos-server-e47d50a443f0a396321716a506e1df325dd4a1fb.zip
Merge branch 'master' of https://github.com/coinos/coinos-server into notifications
Diffstat (limited to 'lib/db.js')
-rw-r--r--lib/db.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/db.js b/lib/db.js
index 7b7fefdb..17d88639 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -1,6 +1,7 @@
import config from "$config";
import { sleep } from "$lib/utils";
import { createClient } from "redis";
+import { warn } from "$lib/logging";
export const db = createClient({ url: config.db });
try {
@@ -15,11 +16,17 @@ export let g = async k => {
let v = await db.get(k);
try {
return JSON.parse(v);
- } catch(e) {
+ } catch (e) {
return v;
- }
-}
-export let s = (k, v) => db.set(k, JSON.stringify(v));
+ }
+};
+export let s = (k, v) => {
+ if (k === "user:null" || k === "user:undefined") {
+ warn("###### NULL USER #######");
+ console.trace();
+ }
+ db.set(k, JSON.stringify(v));
+};
let retries = {};
export let t = async (k, f) => {