comparison 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
comparison
equal deleted inserted replaced
2949:e6204cd21443 2950:dc18d5804746
1083 static bool ConfigureServerContext(IDatabaseWrapper& database, 1083 static bool ConfigureServerContext(IDatabaseWrapper& database,
1084 IStorageArea& storageArea, 1084 IStorageArea& storageArea,
1085 OrthancPlugins *plugins, 1085 OrthancPlugins *plugins,
1086 bool loadJobsFromDatabase) 1086 bool loadJobsFromDatabase)
1087 { 1087 {
1088 ServerContext context(database, storageArea, false /* not running unit tests */); 1088 size_t maxCompletedJobs;
1089 1089
1090 { 1090 {
1091 OrthancConfiguration::ReaderLock lock; 1091 OrthancConfiguration::ReaderLock lock;
1092 1092
1093 // These configuration options must be set before creating the 1093 // These configuration options must be set before creating the
1094 // ServerContext, otherwise the possible Lua scripts will not be 1094 // ServerContext, otherwise the possible Lua scripts will not be
1099 HttpClient::SetDefaultVerbose(lock.GetConfiguration().GetBooleanParameter("HttpVerbose", false)); 1099 HttpClient::SetDefaultVerbose(lock.GetConfiguration().GetBooleanParameter("HttpVerbose", false));
1100 HttpClient::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpTimeout", 0)); 1100 HttpClient::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpTimeout", 0));
1101 HttpClient::SetDefaultProxy(lock.GetConfiguration().GetStringParameter("HttpProxy", "")); 1101 HttpClient::SetDefaultProxy(lock.GetConfiguration().GetStringParameter("HttpProxy", ""));
1102 1102
1103 DicomUserConnection::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScuTimeout", 10)); 1103 DicomUserConnection::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScuTimeout", 10));
1104
1105 maxCompletedJobs = lock.GetConfiguration().GetUnsignedIntegerParameter("JobsHistorySize", 10);
1106 }
1107
1108 ServerContext context(database, storageArea, false /* not running unit tests */, maxCompletedJobs);
1109
1110 {
1111 OrthancConfiguration::ReaderLock lock;
1112
1104 context.SetCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("StorageCompression", false)); 1113 context.SetCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("StorageCompression", false));
1105 context.SetStoreMD5ForAttachments(lock.GetConfiguration().GetBooleanParameter("StoreMD5ForAttachments", true)); 1114 context.SetStoreMD5ForAttachments(lock.GetConfiguration().GetBooleanParameter("StoreMD5ForAttachments", true));
1106 1115
1107 // New option in Orthanc 1.4.2 1116 // New option in Orthanc 1.4.2
1108 context.GetIndex().SetOverwriteInstances(lock.GetConfiguration().GetBooleanParameter("OverwriteInstances", false)); 1117 context.GetIndex().SetOverwriteInstances(lock.GetConfiguration().GetBooleanParameter("OverwriteInstances", false));
1123 } 1132 }
1124 catch (...) 1133 catch (...)
1125 { 1134 {
1126 context.GetIndex().SetMaximumStorageSize(0); 1135 context.GetIndex().SetMaximumStorageSize(0);
1127 } 1136 }
1128
1129 context.GetJobsEngine().GetRegistry().SetMaxCompletedJobs
1130 (lock.GetConfiguration().GetUnsignedIntegerParameter("JobsHistorySize", 10));
1131 } 1137 }
1132 1138
1133 { 1139 {
1134 ServerContextConfigurator configurator(context, plugins); 1140 ServerContextConfigurator configurator(context, plugins);
1135 1141