From 728ac80f9cc8a3268bdced6339f58936bd69648b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 22 Dec 2022 09:51:53 -0800 Subject: prettier --- lib/nostr.js | 5 ++++- lib/store.js | 2 +- lib/utils.js | 2 +- routes/events.js | 8 +++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/nostr.js b/lib/nostr.js index c75955bd..53c8d7d1 100644 --- a/lib/nostr.js +++ b/lib/nostr.js @@ -44,7 +44,10 @@ pool.on("event", async (relay, sub, ev) => { await redis.sAdd(pubkey, ev.id); await redis.set(`ev:${ev.id}`, JSON.stringify(ev)); - store.timeouts[pubkey] = setTimeout(() => (store.fetching[pubkey] = false), 100); + store.timeouts[pubkey] = setTimeout( + () => (store.fetching[pubkey] = false), + 100 + ); } } catch (e) { console.log(e); diff --git a/lib/store.js b/lib/store.js index f6f65521..e42afeda 100644 --- a/lib/store.js +++ b/lib/store.js @@ -22,5 +22,5 @@ export default { last: {}, payments: [], fetching: {}, - timeouts: {}, + timeouts: {} }; diff --git a/lib/utils.js b/lib/utils.js index 7fdd10b3..46267dbd 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -172,7 +172,7 @@ export const derivePayRequest = async ({ amount, memo, tip }) => { ).bolt11; }; -export const sleep = (n) => new Promise((r) => setTimeout(r, n)); +export const sleep = n => new Promise(r => setTimeout(r, n)); export const wait = async (f, s = 300, n = 1000) => { let i = 0; while (!(await f()) && i < s) (await sleep(n)) && i++; diff --git a/routes/events.js b/routes/events.js index ab682b46..18abf1d7 100644 --- a/routes/events.js +++ b/routes/events.js @@ -8,7 +8,10 @@ app.get("/:pubkey/events", async (req, res) => { try { let { pubkey } = req.params; store.fetching[pubkey] = true; - store.timeouts[pubkey] = setTimeout(() => (store.fetching[pubkey] = false), 500); + store.timeouts[pubkey] = setTimeout( + () => (store.fetching[pubkey] = false), + 500 + ); pool.subscribe(pubkey, { limit: 500, @@ -29,9 +32,8 @@ app.get("/:pubkey/events", async (req, res) => { } }); -app.post('/nostr/send', async (req, res) => { +app.post("/nostr/send", async (req, res) => { let { event } = req.body; pool.send(["EVENT", event]); res.send(event); }); - -- cgit v1.2.3