Hangfire ignores AutomaticRetry attribute on method (bug)

Created on 26 Sep 2018  路  1Comment  路  Source: HangfireIO/Hangfire

I have set automatic retry attempts to be default 3 (instead 10 as I believe is by default)

Hangfire.GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 3 })

but for some job I want to set attempts count to 0

public interface IMyJob
{
    void DoSomething();
}

public class MyBackgroundJob : IMyJob
{
    [AutomaticRetry(Attempts = 0)]
    public void DoSomething()
    {
    }
}

Hangfire ingores this attribute and tries 3 attempts instead of 0.

question

Most helpful comment

It turns out that I need to put attribute on interface method

[AutomaticRetry(Attempts = 0)]
void DoSomething();

>All comments

It turns out that I need to put attribute on interface method

[AutomaticRetry(Attempts = 0)]
void DoSomething();
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nsnail picture nsnail  路  3Comments

pwueje picture pwueje  路  4Comments

dgaspar picture dgaspar  路  4Comments

cindro picture cindro  路  3Comments

vikramjb picture vikramjb  路  3Comments