private static void Increase(IPollingTimeout timeout, int count) { for (var i = 0; i < count; i++) { timeout.Increase(); } }
private async Task PollingCycle(IPollingTimeout timeout, PollingFunction func, CancellationToken token) { await Task.Yield(); while (!token.IsCancellationRequested) { if (await func(token).ContinueWith(OnJobFunctionCompleted)) { timeout.Reset(); await timeout.WaitAsync(token); } else { await timeout.WaitAsync(token); timeout.Increase(); } } }