fix: use interval option
This commit is contained in:
@@ -16,11 +16,14 @@ public class OnspringWorker(
|
|||||||
{
|
{
|
||||||
_logger.LogInformation("Onspring worker started");
|
_logger.LogInformation("Onspring worker started");
|
||||||
|
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
var onspringOptions = scope.ServiceProvider.GetRequiredService<OnspringOptions>();
|
||||||
|
|
||||||
_timer = _timeProvider.CreateTimer(
|
_timer = _timeProvider.CreateTimer(
|
||||||
callback: async _ => await RunSearchRequests(),
|
callback: async _ => await RunSearchRequests(),
|
||||||
state: null,
|
state: null,
|
||||||
dueTime: TimeSpan.Zero,
|
dueTime: TimeSpan.FromMinutes(onspringOptions.SearchIntervalInMinutes),
|
||||||
period: TimeSpan.FromMinutes(1)
|
period: TimeSpan.FromMinutes(onspringOptions.SearchIntervalInMinutes)
|
||||||
);
|
);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
Reference in New Issue
Block a user