Webhook deletion does not clean up deliveries and delivery results #24
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/webhooker#24
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
When a webhook is deleted via
HandleSourceDelete()insource_management.go, the handler soft-deletes child entrypoints, targets, and events:But it does NOT clean up:
This leaves orphaned records in the database. Since Delivery references Event and Target by foreign key, and GORM uses soft deletes, the orphaned deliveries will reference soft-deleted parents, which can cause issues with the delivery engine (it queries for
pending/retryingdeliveries and tries to preload their targets and events).Additionally, the delivery engine could attempt to process deliveries for a deleted webhook's targets, leading to errors or unintended behavior.
Fix
Also soft-delete related deliveries and results in the same transaction:
Category
Should-fix. Orphaned records cause data integrity issues.