diff options
| author | Adam Soltys <[email protected]> | 2024-03-05 16:38:47 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-03-05 16:38:47 -0800 |
| commit | 338d79f611d0ed8aa079c3f71377f12cc50af3b9 (patch) | |
| tree | b0343bfe4d906c3019738081b449ac6ea4114848 | |
| parent | 1abe718e4bf88527662a1b18a9a27b55b5c44d79 (diff) | |
| download | coinos-server-338d79f611d0ed8aa079c3f71377f12cc50af3b9.tar.gz coinos-server-338d79f611d0ed8aa079c3f71377f12cc50af3b9.zip | |
fix queuing
| -rw-r--r-- | lib/app.js | 2 | ||||
| -rw-r--r-- | lib/migrate.js | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -20,7 +20,7 @@ const app = fastify({ }); await app.register(import("@fastify/rate-limit"), { - max: 50, + max: 500, timeWindow: 5000, keyGenerator: (req) => req.headers["cf-connecting-ip"], }); diff --git a/lib/migrate.js b/lib/migrate.js index 4a44ea87..4aa137f8 100644 --- a/lib/migrate.js +++ b/lib/migrate.js @@ -7,6 +7,7 @@ let queued = {}; let migrating = {}; async function migrate(id) { try { + delete queued[id]; if (id) id = id.replace(/\s/g, "").toLowerCase(); let user = await g(`user:${id}`); @@ -80,10 +81,8 @@ async function migrate(id) { if (!recipient) queued[p.ref] = true; } - await multi - .lPush(`${id}:payments`, pid) - .set(`payment:${pid}`, JSON.stringify(p)) - .exec(); + await db.lPush(`${id}:payments`, pid); + await s(`payment:${pid}`, p); await archive.del(`payment:${pid}`); } @@ -119,7 +118,8 @@ async function migrate(id) { let keepMigrating = async () => { try { if (Object.keys(queued).length) { - await migrate(Object.keys(queued)[0]); + let next = Object.keys(queued)[0]; + await migrate(next); } } catch (e) { err("problem migrating", e.message); |
