changeset 6699:c637e22051fa

fix restarting a serialized StoreJob that was being executed
author Alain Mazy <am@orthanc.team>
date Mon, 13 Apr 2026 17:05:53 +0200
parents 83411d1e4022
children 36435a85846a
files OrthancServer/Sources/ServerJobs/StoreJob.cpp OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerJobs/StoreJob.cpp	Mon Apr 13 16:05:10 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/StoreJob.cpp	Mon Apr 13 17:05:53 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 16:05:10 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp	Mon Apr 13 17:05:53 2026 +0200
@@ -167,6 +167,7 @@
       }
 
       const std::string& instanceId = instanceToPreload->GetId();
+      LOG(INFO) << "Loader thread is loading instance " << instanceId;
 
       try
       {