protected override async Task OnStopAsync() { await _CurrentAnalysisResourceListTimerWorkTask.StopAsync(); await _CurrentWorkTaskQueue.StopAsync(); _CurrentAnalysisResourceListTimerWorkTask.Dispose(); _CurrentAnalysisResourceListTimerWorkTask = null; _CurrentWorkTaskQueue.Dispose(); _CurrentWorkTaskQueue = null; await base.OnStopAsync(); }
protected override async Task OnStartAsync() { if (!IsEnabled) { IsRunning = false; return; } _CurrentAnalysisResourceListTimerWorkTask = new TimerWorkTask(OnAnalysisResourceListTimerWorkTask, TaskDelayMilliseconds); _CurrentWorkTaskQueue = new WorkTaskQueue <TCrawlerDataModel>(OnWorkTaskQueue, WorkTaskTotalCount, TaskDelayMilliseconds, ChannelCapacityCount); await _CurrentWorkTaskQueue.StartAsync(); await _CurrentAnalysisResourceListTimerWorkTask.StartAsync(); await base.OnStartAsync(); }