|
|
|
@ -21,7 +21,7 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
public void Add(IBackgroundWorker worker) |
|
|
|
public Task AddAsync(IBackgroundWorker worker) |
|
|
|
{ |
|
|
|
if (worker is IHangfireBackgroundWorker hangfireBackgroundWorker) |
|
|
|
{ |
|
|
|
@ -56,12 +56,12 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return; |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
if (period == null) |
|
|
|
{ |
|
|
|
return; |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
var adapterType = typeof(HangfirePeriodicBackgroundWorkerAdapter<>).MakeGenericType(worker.GetType()); |
|
|
|
@ -69,6 +69,8 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle |
|
|
|
|
|
|
|
RecurringJob.AddOrUpdate(() => workerAdapter.DoWorkAsync(), GetCron(period.Value)); |
|
|
|
} |
|
|
|
|
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetCron(int period) |
|
|
|
|