diff Core/JobsEngine/JobsEngine.cpp @ 2811:7cfc8d266f41

reason for releasing resources in jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Sep 2018 12:32:02 +0200
parents d26dd081df97
children ea7aea6f6a95
line wrap: on
line diff
--- a/Core/JobsEngine/JobsEngine.cpp	Thu Sep 06 11:06:54 2018 +0200
+++ b/Core/JobsEngine/JobsEngine.cpp	Thu Sep 06 12:32:02 2018 +0200
@@ -55,14 +55,14 @@
 
     if (running.IsPauseScheduled())
     {
-      running.GetJob().ReleaseResources();
+      running.GetJob().ReleaseResources(JobReleaseReason_Paused);
       running.MarkPause();
       return false;
     }
 
     if (running.IsCancelScheduled())
     {
-      running.GetJob().ReleaseResources();
+      running.GetJob().ReleaseResources(JobReleaseReason_Canceled);
       running.MarkCanceled();
       return false;
     }
@@ -89,19 +89,19 @@
     switch (result.GetCode())
     {
       case JobStepCode_Success:
+        running.GetJob().ReleaseResources(JobReleaseReason_Success);
         running.UpdateStatus(ErrorCode_Success);
-        running.GetJob().ReleaseResources();
         running.MarkSuccess();
         return false;
 
       case JobStepCode_Failure:
-        running.GetJob().ReleaseResources();
+        running.GetJob().ReleaseResources(JobReleaseReason_Failure);
         running.UpdateStatus(result.GetFailureCode());
         running.MarkFailure();
         return false;
 
       case JobStepCode_Retry:
-        running.GetJob().ReleaseResources();
+        running.GetJob().ReleaseResources(JobReleaseReason_Retry);
         running.UpdateStatus(ErrorCode_Success);
         running.MarkRetry(result.GetRetryTimeout());
         return false;