wanlitao / HangfireExtension

Hangfire Extension plugins
Apache License 2.0
22 stars 32 forks source link

Fix work item executed multiple times issue #19

Closed darkthread closed 2 years ago

darkthread commented 6 years ago

SQLiteJobQueue.Dequeue() used where (FetchedAt is null or FetchedAt < @fetchedAt) instead of where (FetchedAt is null or FetchedAt < DATEADD(second, @timeout, GETUTCDATE())) and this causes work item is fetched by every worker and executed multiple times.

Referring to Hangfire.SqlServer 1.6.14, I add SlidingInvisibilityTimeout option (5 seconds by default) and use it to simulate DATEADD(second, @timeout, GETUTCDATE())), I believe this can fix the duplicated executions issue.

dragouf commented 6 years ago

why this is still not merged ? I have this bug too and it would be nice to have it inside the nuget package

KrazyTako commented 6 years ago

Would like to see this merged as well. I'm currently getting around the issue by setting WorkerCount = 1.

mshenoy83 commented 6 years ago

@wanlitao Is this repo not being maintained anymore??

felixclase commented 4 years ago

Hi,

For those who want to use SQLite as storage in Hangfire you can use this plugin:

https://github.com/raisedapp/Hangfire.Storage.SQLite

https://www.nuget.org/packages/Hangfire.Storage.SQLite

It is written from scratch, based on Hangfire.LiteDB storage.