diff options
| author | Adam Soltys <[email protected]> | 2024-03-05 19:45:08 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-03-05 19:45:08 -0800 |
| commit | 471de1021747e679740654165c2c8568a9b0e93a (patch) | |
| tree | ec961134af3fe6684afc32c3133f338987c1ec69 | |
| parent | 338d79f611d0ed8aa079c3f71377f12cc50af3b9 (diff) | |
| download | coinos-server-471de1021747e679740654165c2c8568a9b0e93a.tar.gz coinos-server-471de1021747e679740654165c2c8568a9b0e93a.zip | |
avoid duplicate invoices
| -rw-r--r-- | lib/migrate.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/migrate.js b/lib/migrate.js index 4aa137f8..106a6b5f 100644 --- a/lib/migrate.js +++ b/lib/migrate.js @@ -91,11 +91,10 @@ async function migrate(id) { let iid; while ((iid = await archive.rPop(`${id}:invoices`))) { let inv = await ga(`invoice:${iid}`); - if (!inv) continue; - await multi - .lPush(`${id}:invoices`, iid) - .set(`invoice:${iid}`, JSON.stringify(inv)) - .exec(); + let pos = await db.lPos(`${id}:invoices`, iid); + if (!inv || pos) continue; + await db.lPush(`${id}:invoices`, iid); + await s(`invoice:${iid}`, inv); await archive.del(`invoice:${iid}`); } |
