Hangfire: In RecurringJob , Job [A] does not completed and still running, and then a new job [A] starts, it maybe makes two jobs processing the same data.

Created on 5 Nov 2017  路  5Comments  路  Source: HangfireIO/Hangfire

In RecurringJob , Job [A] does not completed and still running, and then a new job [A] starts, it maybe makes two jobs processing the same data. what should I do to deal with this situation. for i can't handle the job's running time,so i can't set a reasonable Corn

Most helpful comment

I created a new MaxConcurrentExecutions filter that handles this correctly: https://gist.github.com/henrik-donuts/0e38af74f95ebfce103fd2568d3455f7

All 5 comments

Check the discussion on this page, covering the topic:

http://docs.hangfire.io/en/latest/background-methods/performing-recurrent-tasks.html

It appears these two attributes deal with this situation:

[DisableConcurrentExecution(5)],
[AutomaticRetry(Attempts = 0, LogEvents = false, OnAttemptsExceeded = AttemptsExceededAction.Delete)]

I haven't yet tried recurring jobs myself... So I can't guarantee they work.

@dcorbett-fivebridgesllc
thanks a lot! i'll try it.

@ccccccmd, don't use it, please see #1053. @dcorbett-fivebridgesllc, looks like you are using them, and looks like they do cause your issues with non-processed queues, please see #1053 too.

Any issues I have are not related to use of DisableConcurrentExecution. Not using recurring jobs, and not using this attribute. I had just seen the thread with a solution, and shared it here.

I created a new MaxConcurrentExecutions filter that handles this correctly: https://gist.github.com/henrik-donuts/0e38af74f95ebfce103fd2568d3455f7

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shorbachuk picture shorbachuk  路  4Comments

osmanrahimi picture osmanrahimi  路  3Comments

pwueje picture pwueje  路  4Comments

thurfir picture thurfir  路  4Comments

tompazourek picture tompazourek  路  3Comments