public void DoJob()
 {
     try
     {
         OnDoJob();
         JobFinished?.Invoke(this, EventArgs.Empty);
     }
     catch (Exception err)
     {
         JobFailed?.Invoke(this, err);
         throw;
     }
 }
Esempio n. 2
0
        public void OnJobFailed(JobInfo job, string reason, string details = null, bool notifyUser = false)
        {
            using var scope       = scopeFactory.CreateScope();
            using var dataContext = scope.ServiceProvider.GetRequiredService <DataContext>();

            job.State     = JobState.Failed;
            job.Completed = DateTimeOffset.UtcNow;
            dataContext.SaveChanges();

            userLogger.LogInfo("Job failed", reason, userId: job.UserId, jobId: job.Id);
            JobFailed?.Invoke(this, new JobFailedEventArgs()
            {
                Job = job, Reason = reason, Details = details
            });
        }
 public void InvokeJobFailed(TranslationJob job)
 {
     JobFailed?.Invoke(job);
 }
Esempio n. 4
0
 private void OnJobFailed(JobFailedEventArgs eventArgs) => JobFailed?.Invoke(this, eventArgs);