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);
     }
 }
        public async Task MarkSentAsync(RuleJob job, string dump, RuleResult result, RuleJobResult jobResult, TimeSpan elapsed, Instant finished, Instant?nextCall)
        {
            if (result == RuleResult.Success)
            {
                await statisticsCollection.IncrementSuccess(job.AppId, job.RuleId, finished);
            }
            else
            {
                await statisticsCollection.IncrementFailed(job.AppId, job.RuleId, finished);
            }

            await Collection.UpdateOneAsync(x => x.Id == job.Id,
                                            Update
                                            .Set(x => x.Result, result)
                                            .Set(x => x.LastDump, dump)
                                            .Set(x => x.JobResult, jobResult)
                                            .Set(x => x.NextAttempt, nextCall)
                                            .Inc(x => x.NumCalls, 1));
        }
Beispiel #3
0
        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));
        }