diff options
| author | John Barratt <[email protected]> | 2023-02-28 13:55:59 -0800 |
|---|---|---|
| committer | John Barratt <[email protected]> | 2023-02-28 13:55:59 -0800 |
| commit | e47d50a443f0a396321716a506e1df325dd4a1fb (patch) | |
| tree | 1c010c5970e9cbfbf8671e6f00a97d6518446fdd /lib/db.js | |
| parent | 58e996a4ac227162f171e84530fe898cb504e045 (diff) | |
| parent | e4702b4d13e4d966d735c2ba4657e10d7c436a57 (diff) | |
| download | coinos-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.js | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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) => { |
