changeset 6700:36435a85846a

clarified logs when reloading jobs
author Alain Mazy <am@orthanc.team>
date Mon, 13 Apr 2026 17:06:09 +0200
parents c637e22051fa
children 7b1fe82d3ce1
files OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp OrthancFramework/Sources/JobsEngine/JobsRegistry.h
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Apr 13 17:05:53 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Apr 13 17:06:09 2026 +0200
@@ -800,7 +800,8 @@
 
 
   void JobsRegistry::SubmitInternal(std::string& id,
-                                    JobHandler* handler)
+                                    JobHandler* handler,
+                                    bool fromSerialization)
   {
     if (handler == NULL)
     {
@@ -851,7 +852,14 @@
       std::string jobType;
       handler->GetJob().GetJobType(jobType);
 
-      LOG(INFO) << "New " << jobType << " job submitted with priority " << priority << ": " << id;
+      if (fromSerialization)
+      {
+        LOG(INFO) << "Loaded " << jobType << " job (" << EnumerationToString(handler->GetState()) << ") with priority " << priority << ": " << id;
+      }
+      else
+      {
+        LOG(INFO) << "New " << jobType << " job submitted with priority " << priority << ": " << id;
+      }
 
       if (observer_ != NULL)
       {
@@ -876,7 +884,7 @@
                             IJob* job,        // Takes ownership
                             int priority)
   {
-    SubmitInternal(id, new JobHandler(job, priority));
+    SubmitInternal(id, new JobHandler(job, priority), false);
   }
 
 
@@ -884,7 +892,7 @@
                             int priority)
   {
     std::string id;
-    SubmitInternal(id, new JobHandler(job, priority));
+    SubmitInternal(id, new JobHandler(job, priority), false);
   }
 
 
@@ -1614,7 +1622,7 @@
       const boost::posix_time::ptime lastChangeTime = job->GetLastStateChangeTime();
 
       std::string id;
-      SubmitInternal(id, job.release());
+      SubmitInternal(id, job.release(), true);
 
       // Check whether the job has not been removed (which could be
       // the case if the "maxCompletedJobs_" value gets smaller)
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.h	Mon Apr 13 17:05:53 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.h	Mon Apr 13 17:06:09 2026 +0200
@@ -130,7 +130,8 @@
     void RemoveRetryJob(JobHandler* handler);
 
     void SubmitInternal(std::string& id,
-                        JobHandler* handler);
+                        JobHandler* handler,
+                        bool fromSerialization);
 
   public:
     explicit JobsRegistry(size_t maxCompletedJobs);