Closed agabuza closed 2 years ago
As SQLite DB Locking base on OS file system, there is no reliable way to achieve distributed lock. So best practices is no concurrency, set the workers count to 1 just as follows:
new BackgroundJobServer(new BackgroundJobServerOptions { WorkerCount = 1 });
I believe the main root of the problem is the dequeue method, where GET-UPDATE operation is non-atomic, because there is no any transaction. This allows multiple workers to pick up the same background job, leading to multiple executions.
I am hitting this problem as well...
I have a idea to fix this issue. #19
WorkerCount = 1 worked for me.
Looks like there is some synchronization and/or DB locking issue. Same Work Item processed multiple times (even when max attempts count set) and then stuck in processing forever. In case of large number of workers it might lead to the situation when same work item is being processed by multiple workers in the same time. Any idea or similar issues?