I would love it if Hangfire would support configuring the maximum number of retries per actual job, not per job type. I know I can add an attribute to my job class, but I would like to provide it as an option when enqueuing the job. (I already posted about this in the forum)
So instead of doing this:
[AutomaticRetry(Attempts = 5)]
public class MyJob{}
I want to be able to do something like this:
BackgroundJob.Enqueue<MyJob>(x => x.Execute(), new BackgroundJobOptions { Retries = 5 });
BackgroundJob.Enqueue<MyJob>(x => x.Execute(), new BackgroundJobOptions { Retries = 2 });
This would create two jobs. One would be retried 5 times, the other only 2 times.
I've taken a look at the code and it doesn't seem very easy. But with some pointers, I would be willing to create a PR. I think it might require a change in the data storage, to hold the options per job. Possibly, the BackgroundExecutionOptions class could be used.
But first: is this something you feel would be an improvement?
I would love it if Hangfire would support configuring the maximum number of retries per actual job, not per job type. I know I can add an attribute to my job class, but I would like to provide it as an option when enqueuing the job. (I already posted about this in the forum)
So instead of doing this:
I want to be able to do something like this:
This would create two jobs. One would be retried 5 times, the other only 2 times.
I've taken a look at the code and it doesn't seem very easy. But with some pointers, I would be willing to create a PR. I think it might require a change in the data storage, to hold the options per job. Possibly, the
BackgroundExecutionOptionsclass could be used.But first: is this something you feel would be an improvement?