|
|
@ -28,15 +28,23 @@ namespace Volo.Abp.BackgroundWorkers.Quartz |
|
|
int? period; |
|
|
int? period; |
|
|
var workerType = worker.GetType(); |
|
|
var workerType = worker.GetType(); |
|
|
|
|
|
|
|
|
if (worker is AsyncPeriodicBackgroundWorkerBase || worker is PeriodicBackgroundWorkerBase) |
|
|
if (worker is AsyncPeriodicBackgroundWorkerBase or PeriodicBackgroundWorkerBase) |
|
|
{ |
|
|
{ |
|
|
if (typeof(TWorker) != worker.GetType()) |
|
|
if (typeof(TWorker) != worker.GetType()) |
|
|
{ |
|
|
{ |
|
|
throw new ArgumentException($"{nameof(worker)} type is different from the generic type"); |
|
|
throw new ArgumentException($"{nameof(worker)} type is different from the generic type"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var timer = (AbpAsyncTimer) worker.GetType().GetProperty("Timer", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(worker); |
|
|
var timer = worker.GetType().GetProperty("Timer", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(worker); |
|
|
period = timer?.Period; |
|
|
|
|
|
|
|
|
if (worker is AsyncPeriodicBackgroundWorkerBase) |
|
|
|
|
|
{ |
|
|
|
|
|
period = ((AbpAsyncTimer)timer)?.Period; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
period = ((AbpTimer)timer)?.Period; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|