ash_oban discarded jobs with `trigger_no_longer_applies`
I'm using ash_oban, and I keep seeing quite a few jobs getting discarded with
** (Oban.PerformError) MyApp.SomeDomain.SomeResource.AshOban.Worker.SomeTrigger failed with {:discard, :trigger_no_longer_applies}
. It's quite odd because as far as I can tell, it seems like the jobs are running when I'd expect them to, however I see my oban jobs littered with many of these discarded jobs. I'm curious if this is something that is common/expected in ash_oban, or if it could potentially signal some deeper issue with my setup.
I've started observing some very strange timing bugs recently (the details of which I won't go into here) which are making me suspect these errors could be indicative of something wrong on a deeper level. I'm hoping to at least get a feel for how to interpret these errors, which I can then use to go debug the setup I have.Solution:Jump to solution
It happens if jobs are completed in between the scheduler running it's read query and scheduling the jobs.
https://hexdocs.pm/ash_oban/dsl-ashoban.html#oban-triggers-trigger-trigger_once?
and when the second job runs the read action doesn't return the record anymore because the previous job already set the state to something else, which makes the where condition not apply anymore. If that happens the job is discarded...
2 Replies
Solution
It happens if jobs are completed in between the scheduler running it's read query and scheduling the jobs.
https://hexdocs.pm/ash_oban/dsl-ashoban.html#oban-triggers-trigger-trigger_once?
and when the second job runs the read action doesn't return the record anymore because the previous job already set the state to something else, which makes the where condition not apply anymore. If that happens the job is discarded
ahh
Gotcha, that makes sense. This smells highly related to the bug I'm having. (to be clear the bug is very much on my end and not ash's)
Thanks!