Exemple #1
0
        private async Task UpdatePackageStatusAsync(DataPackage package)
        {
            var newStatus = await _processor.GetStatus(package.JobProcessorReference, package.Status);

            if (newStatus != package.Status)
            {
                package.Status = newStatus;
                if (package.Status == JobStatus.Completed || package.Status == JobStatus.Failed)
                {
                    package.TimeCompleted = DateTime.Now;
                }
                _context.Update(package);
                _context.SaveChanges();
            }
            if (package.Status == JobStatus.Failed || package.Status == JobStatus.Completed)
            {
                Hangfire.RecurringJob.RemoveIfExists("prostatus_" + package.Id);
            }
        }