We’ve been using Hangfire for years with great success. Currently, we are trying to convert some of the methods that hangfire calls to Async as they are remote API calls that can take a while and hog threads in our Saas application. We are using the latest version of Hangfire 1.6.22
Here’s the error:
Method not found: 'Void Hangfire.RecurringJob.AddOrUpdate(System.String, System.Linq.Expressions.Expression`1<System.Func`1<System.Threading.Tasks.Task>>, System.String, System.TimeZoneInfo, System.String)'.
When calling this method in Startup.cs, the error is thrown.
public void ScheduleTasks() {
var dbContext = new InventoryMgmtContext();
var storeFrontRepository = new Repository<StoreFront>(dbContext);
storeFronts = storeFrontRepository.GetAll().ToList();
foreach (var storeFront in storeFronts) {
//storeFront.StoreFrontItemMappings = null;
var syncErpWithNewOrUpdatedItemsTask = new SyncErpWithNewOrUpdatedItemsTask();
RecurringJob.AddOrUpdate(storeFront.Description + ": Store Front to Mozzo: Items",
() => syncErpWithNewOrUpdatedItemsTask.Execute(storeFront),
#if DEBUG
Cron.Yearly(6), //once every June
#else
"*/5 * * * *", //every 5 min
#endif
TimeZoneInfo.Local);
<...>
The method signature it is calling is:
public async Task<ActionConfirmation<int>> Execute(StoreFront storeFront)