public Task StartAsync(IGlobe globe, IAutoplayContext context) { if (globe is null) { throw new ArgumentNullException(nameof(globe)); } if (context is null) { throw new ArgumentNullException(nameof(context)); } return(StartInternalAsync(globe, context)); }
private async Task StartInternalAsync(IGlobe globe, IAutoplayContext context) { var iterationCounter = 1; while (await context.CheckNextIterationAsync() && iterationCounter <= ITERATION_LIMIT) { for (var updateCounter = 0; updateCounter < GlobeMetrics.OneIterationLength; updateCounter++) { try { await globe.UpdateAsync(CancellationToken.None).ConfigureAwait(false); } catch (ActorTaskExecutionException exception) { CatchActorTaskExecutionException(exception); } catch (AggregateException exception) { CatchException(exception.InnerException); throw; } } iterationCounter++; } if (iterationCounter >= ITERATION_LIMIT) { if (PlayerEventLogService != null) { var endOfLifeEvent = new EndOfLifeEvent(); PlayerEventLogService.Log(endOfLifeEvent); } } ProcessEnd(); }