@ajakblackgoat, sorry for the delay. As for now, you can query jobs only by their ID. Later I’m planning to add the filtering feature, but it will require table or index scan and is not affordable for applications (except for monitoring). If you want to track your jobs, integrate background job ids with your domain model and query jobs based on their Ids.
But it is better to add another attribute to your entities, such as IsCompleted
, or PercentsCompleted
, because:
- succeeded or deleted background jobs expire after some time (one day by default), and it is hard to determine whether it was succeeded or deleted;
- it is hard to predict the state consequence of a single job. The simplest path is:
Enqueued
→Processing
→Succeeded
, but it can beEnqueued
→Processing
→Succeeded
→Deleted by admin
→Enqueued by other admin
→Processing
→Failed
→Deleted
– state workflow can be very complex, do not rely on them.