changeset 6704:acb331209309

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 Apr 2026 17:46:00 +0200
parents f7ba463e9f9f (current diff) 7b1fe82d3ce1 (diff)
children 2c1b578ed9ba
files
diffstat 4 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Apr 13 17:45:15 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Apr 13 17:46:00 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:45:15 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.h	Mon Apr 13 17:46:00 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);
--- a/OrthancServer/Sources/ServerJobs/StoreJob.cpp	Mon Apr 13 17:45:15 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/StoreJob.cpp	Mon Apr 13 17:46:00 2026 +0200
@@ -92,7 +92,8 @@
 
     instancesLoader_.reset(new ThreadedInstancesLoader(context_, loaderThreads, false, DicomTransferSyntax_LittleEndianImplicit /* dummy value not used*/, 0, GetLoaderPrefix()));
 
-    for (size_t i = 0; i < instancesIds_.size(); ++i)
+    size_t position = GetPosition(); // in case we reload a job in progress, we shall not preload the first instances
+    for (size_t i = position; i < instancesIds_.size(); ++i)
     {
       instancesLoader_->PreloadDicomInstance(instancesIds_[i], filesInfo_[i]);
     }
--- a/OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp	Mon Apr 13 17:45:15 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp	Mon Apr 13 17:46:00 2026 +0200
@@ -167,6 +167,7 @@
       }
 
       const std::string& instanceId = instanceToPreload->GetId();
+      LOG(INFO) << "Loader thread is loading instance " << instanceId;
 
       try
       {