saurabhnanda / odd-jobs

Haskell job queue with admin UI and loads of other features.
https://www.haskelltutorials.com/odd-jobs/
BSD 3-Clause "New" or "Revised" License
75 stars 29 forks source link

Implement all callbacks #68

Closed saurabhnanda closed 1 year ago

saurabhnanda commented 3 years ago

Fixes #63

ivanbakel commented 3 years ago

Would love to see this go in, since I would like to start using cfgOnJobTimeout. Is there anything I can do to help?

ivb-supercede commented 1 year ago

The changes required to get onJobTimeout working are a bit cryptic. I've got a changeset that works for testing locally, but why exactly it works, and why the changes are necessary, is unclear. I think the combination of masking and uninterruptable actions in runJobWithTimeout can lead to threads being blocked in unintuitive ways, which also lines up with my experience that TimeoutExceptions are never thrown by even long-running jobs.

ivb-supercede commented 1 year ago

Alright, I appear to have fixed the issue. I still don't know exactly if masking matters or not, but changing the timeout code to not call uninterruptibleCancel allows the timeout exception to be propagated properly, which causes the callback to be called at the appropriate time.