Exemplo n.º 1
0
 /// <summary>
 /// Create timer based on <paramref name="executionInterval"/>.
 /// </summary>
 private Timer CreateTimer(PositiveTimeSpan executionInterval)
 => executionInterval
 .To(interval => new Timer(interval.TotalMilliseconds)
 {
     AutoReset = false
 })
 .Then(intervalTimer => intervalTimer.Elapsed += async(_, _) => await ExecuteIteration());
Exemplo n.º 2
0
 protected JobBase(
     PositiveTimeSpan executionInterval,
     IServiceScopeFactory serviceScopeFactory,
     ILogger <JobBase> logger)
 {
     timer = CreateTimer(executionInterval);
     this.serviceScopeFactory = serviceScopeFactory;
     this.logger = logger;
 }
Exemplo n.º 3
0
        /// <inheritdoc />
        async IAsyncEnumerable <LsnHistoryEntry> ISystemStorage.GetLsnHistoryAsync(PositiveTimeSpan window)
        {
            await Task.CompletedTask;

            yield return(new(new(2021, 05, 1, 9, 0, 0), new("32/A0000100")));

            yield return(new(new(2021, 05, 1, 9, 1, 0), new("32/A0001000")));

            yield return(new(new(2021, 05, 1, 9, 2, 0), new("32/A0010000")));

            yield return(new(new(2021, 05, 1, 9, 3, 0), new("32/A0100000")));
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        async IAsyncEnumerable <BloatFractionHistoryEntry> ISystemStorage.GetBloatFractionHistory(PositiveTimeSpan window)
        {
            await Task.CompletedTask;

            yield return(new(new(2021, 05, 1, 09, 0, 0), 0.4M));

            yield return(new(new(2021, 05, 1, 12, 0, 0), 0.5M));

            yield return(new(new(2021, 05, 1, 15, 0, 0), 0.6M));

            yield return(new(new(2021, 05, 1, 18, 0, 0), 0.5M));
        }