✨ Add maintenance task to remove unredeemed vouchers of deleted users#1237
✨ Add maintenance task to remove unredeemed vouchers of deleted users#12370x46616c6b wants to merge 1 commit intomainfrom
Conversation
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>
75725ac to
45e5578
Compare
|
|
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. |



Summary
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.