Resolve "Jobs get stuck when a SystemExit happens during the initialization phase (pending state)"
What is in this MR
We fix the problem in two ways:
- First we ensure that if an exception occurs while the job is in pending state outside the job creation transaction (inside the on_commit handler), this exception cause the state of the job to change to
failed
- Then we ensure that a
pending
job get expired by the cleanup job as it should be.
How to test this MR
Difficult to test it in real condition, the tests run and it's more about the logic used to handle this problem.
Merge Request Checklist
-
changelog.md has been updated if required. -
New/updated Premium/Enterprise features are separated correctly in the premium or enterprise folder -
The latest Chrome and Firefox have been used to test any new frontend features -
Documentation has been updated -
Quality Standards are met -
Performance: tables are still fast with 100k+ rows, 100+ field tables -
The redoc API pages have been updated for any REST API changes -
Our custom API docs are updated for changes to endpoints accessed via api tokens -
The UI/UX has been updated following UI Style Guide
Closes #1615 (closed)
Edited by Jérémie Pardou