public Task UpdateAsync(RuleJob job, RuleJobUpdate update) { Guard.NotNull(job, nameof(job)); Guard.NotNull(update, nameof(update)); return(Task.WhenAll( UpdateStatisticsAsync(job, update), UpdateEventAsync(job, update))); }
public Task UpdateAsync(RuleJob job, RuleJobUpdate update, CancellationToken ct = default) { Guard.NotNull(job); Guard.NotNull(update); return(Task.WhenAll( UpdateStatisticsAsync(job, update, ct), UpdateEventAsync(job, update, ct))); }
private Task UpdateEventAsync(RuleJob job, RuleJobUpdate update) { return(Collection.UpdateOneAsync(x => x.DocumentId == job.Id, Update .Set(x => x.Result, update.ExecutionResult) .Set(x => x.LastDump, update.ExecutionDump) .Set(x => x.JobResult, update.JobResult) .Set(x => x.NextAttempt, update.JobNext) .Inc(x => x.NumCalls, 1))); }
private async Task UpdateStatisticsAsync(RuleJob job, RuleJobUpdate update) { if (update.ExecutionResult == RuleResult.Success) { await statisticsCollection.IncrementSuccess(job.AppId, job.RuleId, update.Finished); } else { await statisticsCollection.IncrementFailed(job.AppId, job.RuleId, update.Finished); } }
private async Task UpdateStatisticsAsync(RuleJob job, RuleJobUpdate update, CancellationToken ct = default) { if (update.ExecutionResult == RuleResult.Success) { await statisticsCollection.IncrementSuccessAsync(job.AppId, job.RuleId, update.Finished, ct); } else { await statisticsCollection.IncrementFailedAsync(job.AppId, job.RuleId, update.Finished, ct); } }
private Task UpdateEventAsync(RuleJob job, RuleJobUpdate update, CancellationToken ct = default) { return(Collection.UpdateOneAsync(x => x.JobId == job.Id, Update .Set(x => x.Result, update.ExecutionResult) .Set(x => x.LastDump, update.ExecutionDump) .Set(x => x.JobResult, update.JobResult) .Set(x => x.NextAttempt, update.JobNext) .Inc(x => x.NumCalls, 1), cancellationToken: ct)); }
public async Task UpdateAsync(RuleJob job, RuleJobUpdate update) { Guard.NotNull(job); Guard.NotNull(update); if (update.ExecutionResult == RuleResult.Success) { await statisticsCollection.IncrementSuccess(job.AppId, job.RuleId, update.Finished); } else { await statisticsCollection.IncrementFailed(job.AppId, job.RuleId, update.Finished); } await Collection.UpdateOneAsync(x => x.Id == job.Id, Update .Set(x => x.Result, update.ExecutionResult) .Set(x => x.LastDump, update.ExecutionDump) .Set(x => x.JobResult, update.JobResult) .Set(x => x.NextAttempt, update.JobNext) .Inc(x => x.NumCalls, 1)); }