Skip to content

✨ Add maintenance task to remove unredeemed vouchers of deleted users#1237

Open
0x46616c6b wants to merge 1 commit intomainfrom
feature/remove-unredeemed-vouchers-maintenance-task
Open

✨ Add maintenance task to remove unredeemed vouchers of deleted users#1237
0x46616c6b wants to merge 1 commit intomainfrom
feature/remove-unredeemed-vouchers-maintenance-task

Conversation

@0x46616c6b
Copy link
Copy Markdown
Member

@0x46616c6b 0x46616c6b commented Apr 9, 2026

Summary

  • Add a scheduled maintenance task that removes unredeemed vouchers belonging to soft-deleted users as a safety-net
  • The task runs weekly at 05:00 via the maintenance scheduler and can be triggered manually from the admin maintenance page
  • While DeleteHandler::deleteUser() already cleans up unredeemed vouchers synchronously during deletion, this task catches any that may have been missed (e.g. race conditions, manual DB changes)

The changes and the PR were generated by OpenCode.

Add a scheduled safety-net task that removes unredeemed vouchers
belonging to soft-deleted users. While DeleteHandler already cleans
up vouchers synchronously during user deletion, this task catches
any that may have been missed due to race conditions or manual
database changes.

The task runs daily at 04:30 via the maintenance scheduler and
can also be triggered manually from the admin maintenance page.

Co-Authored-By: OpenCode <noreply@opencode.ai>
@0x46616c6b 0x46616c6b force-pushed the feature/remove-unredeemed-vouchers-maintenance-task branch from 75725ac to 45e5578 Compare April 9, 2026 12:19
@0x46616c6b 0x46616c6b marked this pull request as ready for review April 9, 2026 12:22
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

@y3n4
Copy link
Copy Markdown
Contributor

y3n4 commented Apr 9, 2026

Feels like a lot of new code when a database migration should also do the job, at least for existing remnants, IMO.

If we assume that race conditions can lead to a voucher not being deleted, I would rather try to fix/harden the delete handler.

Don't want to stand in your way though.

@0x46616c6b
Copy link
Copy Markdown
Member Author

Feels like a lot of new code when a database migration should also do the job, at least for existing remnants, IMO.

If we assume that race conditions can lead to a voucher not being deleted, I would rather try to fix/harden the delete handler.

Don't want to stand in your way though.

It's about 70 lines of code (not including tests), which I think is okay. In comparison, a migration also requires a few lines of code and is a one-shot.

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.

2 participants