Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mysql] prevent cascading deletes on jobs by keep_alive_at #421

Merged
merged 1 commit into from
Sep 21, 2024

Conversation

dlen
Copy link
Contributor

@dlen dlen commented Sep 20, 2024

keep_alive_at function uses replace to update the worker row and that forces the jobs child rows to be deleted due to their foreign key relationship. This behavior is due MySQL REPLACE deletes first a row when duplicated.

Using INSERT .. ON DUPLICATE KEY solves the issue. Jobs are not deleted anymore when the keep_alive_at runs. Users should be responsible about truncating the jobs table with this approach. Fixes #48

@geofmureithi geofmureithi changed the title Mysql backend keep done jobs [mysql] prevent cascading deletes on jobs by keep_alive_at Sep 21, 2024
@geofmureithi
Copy link
Owner

Thanks for this catch, this is one of the longest running issue on this repo.

@geofmureithi geofmureithi merged commit d348630 into geofmureithi:master Sep 21, 2024
6 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.

No Done jobs
2 participants