Hi, I have a question about the way background jobs work. I know that the worker checks background jobs every 30 seconds and takes 1000 at a time by default.
Say it started the process of 1000 jobs but before the job execution finished the worker fetched 1000 more which also includes some of the jobs that exist in first execution. How does abp handle this? Same job is executed twice? Or abp does not fetch the second 1000 because the first 1000 is still executed? or it smartly eliminates the executed ones and only fetches new jobs in following fetches?
thank you
1 Answer(s)
-
0
Hi @uenlkr4e,
ABP ensures that the same job is not executed twice by marking jobs as "IsAbandoned" when fetched and excluding them from subsequent fetches until they are completed or failed. This mechanism prevents duplicate execution and ensures reliable job processing.
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/BackgroundJobs/BackgroundJobInfo.cs