From the documentation, it seems that the background jobs are retried for up to 2 days which is the default timeout.
- Is there a way to cancel the job in case of exceptions?
- How do I get the identifier for the current BackgroundJob<TJobArgs> which is being executed?
- Also, how can I push the exceptions from a background job into the audit logs?
4 Answer(s)
-
0
Hi,
Is there a way to cancel the job in case of exceptions? I haven't tried it but you can set BackgroundJobInfo.DefaultWaitFactor = 0; In that case all jobs will be abondened when they fail.
How do I get the identifier for the current BackgroundJob<TJobArgs> which is being executed? This is not at the moment, you can create an issue on github if you like, here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues">https://github.com/aspnetboilerplate/as ... ate/issues</a>.
Also, how can I push the exceptions from a background job into the audit logs? Have you tried this <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Audit-Logging#DocEnableDisableByAttrs">https://aspnetboilerplate.com/Pages/Doc ... bleByAttrs</a> ?
Thanks.
-
0
Thanks I'll try out the BackgroundJobInfo.DefaultWaitFactor = 0 for single attempt jobs.
For the Auditing, I did take a look at it but since it needed the tenantId and userid, I didn't think that it'd work. I was not sure where the background job would produce those values.
-
0
The [Audited] attribute worked. The username, client, ipaddress and browser are null but that would be as expected.
-
0
Great :)