diff options
| author | Adam Soltys <[email protected]> | 2026-05-17 23:50:16 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-05-17 23:50:16 -0700 |
| commit | 7c1eefc142c951d7db5a0fa1afeae64a2fdf02fd (patch) | |
| tree | 1c2569134b163d30a930beb9a2da066ba941fd8d | |
| parent | 0d40e407f4c1a14a7da9466e38ade97adbdeeaee (diff) | |
| download | coinos-server-7c1eefc142c951d7db5a0fa1afeae64a2fdf02fd.tar.gz coinos-server-7c1eefc142c951d7db5a0fa1afeae64a2fdf02fd.zip | |
don't remove orphan payment ids from user payment lists
When the underlying payment record is missing, removing the id from the
user's payments list was destructive — a transiently unavailable record
(arc fallback miss, database hiccup) would cause us to permanently drop
the pointer. Leave the orphan in place so a back-fill from an RDB backup
can restore the record under the same id later.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
| -rw-r--r-- | routes/payments.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/routes/payments.ts b/routes/payments.ts index 65086afd..7cdf8923 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -202,14 +202,16 @@ export default { const paymentKeys = payments.map((pid) => `payment:${pid}`); const fetched = await gfAll(paymentKeys); - const missingIds: any[] = []; const validPayments: any[] = []; for (let i = 0; i < fetched.length; i++) { const p = fetched[i]; if (!p) { + // Don't lRem the id — the underlying record may be temporarily + // unavailable (arc fallback miss, transient db issue) and we'd + // permanently lose the user's payment history pointer. Leave the + // orphan in the list so a back-fill from a backup can restore it. warn("user", id, "missing payment", payments[i]); - missingIds.push(payments[i]); continue; } if (received && p.amount < 0) continue; @@ -217,10 +219,6 @@ export default { validPayments.push(p); } - if (missingIds.length) { - for (const pid of missingIds) await db.lRem(listKey, 0, pid); - } - const internalRefs = [...new Set( validPayments .filter((p) => p.type === PaymentType.internal && p.ref) |
