Code rearrange for services and charting
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System.Linq;
|
||||
using LeafWeb.Core.Entities;
|
||||
|
||||
namespace LeafWeb.Web.Services.PiscalQueue
|
||||
{
|
||||
public class FinishComplete : PiscalQueueWorker
|
||||
{
|
||||
protected override void DoWorkInternal(LeafInput leafInput)
|
||||
{
|
||||
Logger.Trace("LeafInput: {0}, RetrieveOutputFiles", leafInput.Id);
|
||||
|
||||
var leafOutputFiles = PiscalService.RetrieveOutputFiles(leafInput).ToList();
|
||||
|
||||
Logger.Trace("LeafInput: {0}, RetrieveOutputFiles saving output files", leafInput.Id);
|
||||
|
||||
foreach (var outputFile in leafOutputFiles)
|
||||
{
|
||||
if (leafInput.OutputFiles.All(file => file.Filename != outputFile.Filename))
|
||||
DataService.AddLeafOutputFile(outputFile);
|
||||
else
|
||||
Logger.Warn("LeafInput: {0}, RetrieveOutputFiles duplicate file name: {1}", leafInput.Id, outputFile.Filename);
|
||||
}
|
||||
|
||||
Logger.Info("LeafInput: {0}, RetrieveOutputFiles output files: {1}", leafInput.Id,
|
||||
string.Join(", ", leafOutputFiles.Select(o => o.Filename)));
|
||||
|
||||
Logger.Trace("LeafInput: {0}, Set Complete", leafInput.Id);
|
||||
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Complete);
|
||||
|
||||
BackgroundJobEnqueueRetry<EmailNotificationService>(email => email.SendLeafWebComplete(leafInput.Id));
|
||||
|
||||
Logger.Info("LeafInput: {0}, Cleanup", leafInput.Id);
|
||||
PiscalService.Cleanup(leafInput);
|
||||
|
||||
HangfireStartup.TriggerPiscalProcessQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user