flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Backend] Add scheduled cron job to prune expired idempotency keys from database

Open blurbeast opened this issue 2 months ago â€ĸ 3 comments

Overview

The API uses idempotency keys to prevent duplicate transactions on stream creation. Without automatic retention cleanup, the idempotency table grows indefinitely.

Problem

  • Unbounded growth in table size wastes database storage and degrades index performance over time.

Proposed Changes

  1. Add a scheduled cleanup task running every 24 hours (or node-cron in worker).
  2. Delete records where createdAt < NOW() - INTERVAL '7 days'.

Acceptance Criteria

  • [ ] Cron worker successfully deletes records older than retention period.
  • [ ] Cleanups log count of pruned records.
  • [ ] Unit test verifies records within retention window are preserved.

blurbeast avatar Sep 27 '26 05:09 blurbeast

@Chinko21 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

I would like to fix this

â„šī¸ Repo Maintainers: To accept this application, review their application or assign @Chinko21 to this issue.

Chinko21 avatar Sep 27 '26 15:09 Chinko21

Congratulations, @Chinko21! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

🧑‍đŸ’ģ @Chinko21: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Sep 27 '26 15:09 drips-wave[bot]

This issue has been marked as completed by a Drips Wave moderator for @Chinko21 as part of the Stellar Wave Program's 10th Wave đŸĨŗ

Moderator's reason: [Auto-assessed] The PR #1561 was merged by maintainers on 2026-10-09 as evidenced by the mergedAt timestamp. The contribution successfully adds the idempotency key model, migration, retention worker, and comprehensive unit tests fulfilling all requirements of issue #1495.

😎 @Chinko21: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here.

🧑‍đŸ’ģ Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

â„šī¸ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.

drips-wave[bot] avatar Oct 20 '26 07:10 drips-wave[bot]