diff OrthancServer/main.cpp @ 2950:dc18d5804746

support of JobsHistorySize set to zero
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Nov 2018 17:19:57 +0100
parents 2e751f615e03
children 4ceb9bf7b00c
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Thu Nov 29 20:36:55 2018 +0100
+++ b/OrthancServer/main.cpp	Fri Nov 30 17:19:57 2018 +0100
@@ -1085,8 +1085,8 @@
                                    OrthancPlugins *plugins,
                                    bool loadJobsFromDatabase)
 {
-  ServerContext context(database, storageArea, false /* not running unit tests */);
-
+  size_t maxCompletedJobs;
+  
   {
     OrthancConfiguration::ReaderLock lock;
 
@@ -1101,6 +1101,15 @@
     HttpClient::SetDefaultProxy(lock.GetConfiguration().GetStringParameter("HttpProxy", ""));
     
     DicomUserConnection::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScuTimeout", 10));
+
+    maxCompletedJobs = lock.GetConfiguration().GetUnsignedIntegerParameter("JobsHistorySize", 10);
+  }
+  
+  ServerContext context(database, storageArea, false /* not running unit tests */, maxCompletedJobs);
+
+  {
+    OrthancConfiguration::ReaderLock lock;
+
     context.SetCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("StorageCompression", false));
     context.SetStoreMD5ForAttachments(lock.GetConfiguration().GetBooleanParameter("StoreMD5ForAttachments", true));
 
@@ -1125,9 +1134,6 @@
     {
       context.GetIndex().SetMaximumStorageSize(0);
     }
-
-    context.GetJobsEngine().GetRegistry().SetMaxCompletedJobs
-      (lock.GetConfiguration().GetUnsignedIntegerParameter("JobsHistorySize", 10));
   }
 
   {