public void RunProcessing(string fileId, string filePath, IJobCancellationToken cancellationToken) { using (var processor = new PngProcessor()) { processor.ProgressChanged += (status) => { ImageProcessingStorage.UpdateFileStatus(fileId, status); }; ImageProcessingStorage.UpdateFileStatus(fileId, 0); processor.Process(filePath); // Sadly, but I can't schedule it as a continuation of current job. BackgroundJob.Schedule(() => ImageProcessingStorage.RemoveFileJobPairByFileName(fileId), DateTime.Now.AddMinutes(10)); } }
public void RemoveJobId(string fileId) { ImageProcessingStorage.RemoveFileJobPairByFileName(fileId); }
public string GetJobId(string fileId) { return(ImageProcessingStorage.GetJobIdByFile(fileId)); }
public double?GetStatus(string fileId) { return(ImageProcessingStorage.GetStatus(fileId)); }
public void RegisterNewJob(string fileId, string jobId) { ImageProcessingStorage.AddFileJobPair(fileId, jobId); }