Skip to content

feat: replace JSON file DLQ with Prisma database storage (#69)#80

Merged
robertocarlous merged 1 commit into
Neurowealth:mainfrom
Xaxxoo:feat/issue-69-persistent-dlq
May 29, 2026
Merged

feat: replace JSON file DLQ with Prisma database storage (#69)#80
robertocarlous merged 1 commit into
Neurowealth:mainfrom
Xaxxoo:feat/issue-69-persistent-dlq

Conversation

@Xaxxoo
Copy link
Copy Markdown
Contributor

@Xaxxoo Xaxxoo commented May 26, 2026

Summary

  • Adds DlqStatus enum (PENDING, RETRIED, RESOLVED) and DeadLetterQueue model to prisma/schema.prisma
  • Rewrites src/stellar/dlq.ts to use Prisma exclusively — all file-system (fs) operations removed
  • add() creates a DB row; retryAll() updates status/retryCount atomically; getSize() queries the DB; resolve() uses updateMany
  • DLQ state now survives container restarts and scales horizontally

Migration required

npx prisma migrate dev --name add-dead-letter-queue

Test plan

  • DeadLetterQueue.add(event, msg) inserts a row with status=PENDING
  • DeadLetterQueue.retryAll() marks successful retries as RESOLVED and failed ones as RETRIED, incrementing retryCount
  • DeadLetterQueue.getSize() returns the correct DB count after add/resolve
  • DeadLetterQueue.resolve(id) sets status=RESOLVED for the given ID
  • Restarting the server does not lose DLQ entries
  • Run npm test -- src/stellar/__tests__/stellar.test.ts — new DLQ tests pass

Closes #69

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 26, 2026

@Xaxxoo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Resolves Neurowealth#69 - adds DeadLetterQueue model and DlqStatus enum to the Prisma
schema, rewrites dlq.ts to persist DLQ entries in PostgreSQL via Prisma,
and removes all file-system (fs) operations. Retry counts and status
are updated atomically in-place; getSize() queries the DB so the count
is always accurate across restarts and containers. Alert threshold check
uses a live DB count instead of the in-memory queue length.
@Xaxxoo Xaxxoo force-pushed the feat/issue-69-persistent-dlq branch from 0f2f86a to d5a461e Compare May 29, 2026 20:04
@robertocarlous robertocarlous merged commit ff6fdbe into Neurowealth:main May 29, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace JSON file dead-letter queue with persistent storage

2 participants