private async Task StopResultQueueProcessingAsync() { mLogger.Debug("Stopping result queue processing..."); await mTaskResultQueue.StopAsync(); mLogger.Debug("Successfully stopped result queue processing."); }
public async Task Test_CanStartStop(int repeatCycles, int timeBetweenStartStopCalls) { using (PostgreSqlTaskResultQueue rq = CreateResultQueue()) { for (int i = 0; i < repeatCycles; i++) { await rq.StartAsync(); Assert.IsTrue(rq.IsRunning); if (timeBetweenStartStopCalls > 0) { await Task.Delay(timeBetweenStartStopCalls); } await rq.StopAsync(); Assert.IsFalse(rq.IsRunning); } } }
private async Task Run_PostResultTests(Func <TaskExecutionResult> rsFactory) { using (PostgreSqlTaskResultQueue rq = CreateResultQueue()) { await rq.StartAsync(); foreach (IQueuedTaskToken token in mDataSource.SeededTaskTokens) { token.UdpateFromExecutionResult(rsFactory.Invoke()); int affectedRows = await rq.PostResultAsync(token); Assert.AreEqual(1, affectedRows); QueuedTaskResult dbResult = await mDataSource .GetQueuedTaskResultFromDbByIdAsync(token.DequeuedTask.Id); dbResult.AssertMatchesResult(token .LastQueuedTaskResult); } await rq.StopAsync(); } }