private async Task InitializeAsync() { _timer?.Stop(); _timer?.Dispose(); _timer = await TimerHelpers.SetTimeoutAsync(HandleCheckIntervalElapsedAsync, 10000, true, true); _discord.MessageReceived -= HandleMessageReceived; _discord.MessageReceived += HandleMessageReceived; }
private async Task InitializeRefreshCheckerAsync() { _refreshInterval = await TimerHelpers.SetTimeoutAsync(async() => { var previousLastRefresh = _lastEventUpdate; var events = await GetEventsAsync(); if (previousLastRefresh < _lastEventUpdate) { _refreshInterval.Stop(); _runningRefresh = false; await UpdateExistingEventEmbedAsync(events); } }, 10000, true); }
private async Task Start() { await TimerHelpers.SetTimeoutAsync(async() => { var sw = new Stopwatch(); sw.Start(); _logger.LogInformation("Getting applications."); var applications = await _neonApiService.GetApplicationListAsync(); if (applications != null) { _logger.LogInformation($"Getting {applications.Count()} applications took {sw.ElapsedMilliseconds} ms."); await CheckForNewApplications(applications); await CheckForOverdueApplications(applications); } }, 60000 * 2, true, true); _discord.MessageReceived -= HandleMessage; _discord.MessageReceived += HandleMessage; }
private async Task StartCheckingForChangesAsync() { _interval = await TimerHelpers.SetTimeoutAsync(CheckForChangeAsync, _settings.CheckInterval, true, true); }
private async Task InitializeServiceAsync() { _checkInterval = await TimerHelpers.SetTimeoutAsync(async() => { await CheckForNewMessagesAsync(); }, 60 * 1000 * 3, true, true); }
private async Task InitializeServiceAsync() { _checkInterval?.Stop(); _checkInterval?.Dispose(); _checkInterval = await TimerHelpers.SetTimeoutAsync(async() => { await CheckForNewTweetsAsync(); }, _settings.CheckIntervalSeconds * 1000, true, true); }