comparison OrthancServer/ServerContext.cpp @ 3165:1fe524e211af

New configuration option: "SaveJobs" to specify whether jobs are stored in the database
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Jan 2019 18:24:13 +0100
parents ac72032d69a2
children 8ea7c4546c3a
comparison
equal deleted inserted replaced
3164:b79ec21747a1 3165:1fe524e211af
194 } 194 }
195 195
196 196
197 void ServerContext::SaveJobsEngine() 197 void ServerContext::SaveJobsEngine()
198 { 198 {
199 VLOG(1) << "Serializing the content of the jobs engine"; 199 if (saveJobs_)
200 {
201 VLOG(1) << "Serializing the content of the jobs engine";
200 202
201 try 203 try
202 { 204 {
203 Json::Value value; 205 Json::Value value;
204 jobsEngine_.GetRegistry().Serialize(value); 206 jobsEngine_.GetRegistry().Serialize(value);
205 207
206 Json::FastWriter writer; 208 Json::FastWriter writer;
207 std::string serialized = writer.write(value); 209 std::string serialized = writer.write(value);
208 210
209 index_.SetGlobalProperty(GlobalProperty_JobsRegistry, serialized); 211 index_.SetGlobalProperty(GlobalProperty_JobsRegistry, serialized);
210 } 212 }
211 catch (OrthancException& e) 213 catch (OrthancException& e)
212 { 214 {
213 LOG(ERROR) << "Cannot serialize the jobs engine: " << e.What(); 215 LOG(ERROR) << "Cannot serialize the jobs engine: " << e.What();
216 }
214 } 217 }
215 } 218 }
216 219
217 220
218 ServerContext::ServerContext(IDatabaseWrapper& database, 221 ServerContext::ServerContext(IDatabaseWrapper& database,
243 new SharedArchive(lock.GetConfiguration().GetUnsignedIntegerParameter("QueryRetrieveSize", 10))); 246 new SharedArchive(lock.GetConfiguration().GetUnsignedIntegerParameter("QueryRetrieveSize", 10)));
244 mediaArchive_.reset( 247 mediaArchive_.reset(
245 new SharedArchive(lock.GetConfiguration().GetUnsignedIntegerParameter("MediaArchiveSize", 1))); 248 new SharedArchive(lock.GetConfiguration().GetUnsignedIntegerParameter("MediaArchiveSize", 1)));
246 defaultLocalAet_ = lock.GetConfiguration().GetStringParameter("DicomAet", "ORTHANC"); 249 defaultLocalAet_ = lock.GetConfiguration().GetStringParameter("DicomAet", "ORTHANC");
247 jobsEngine_.SetWorkersCount(lock.GetConfiguration().GetUnsignedIntegerParameter("ConcurrentJobs", 2)); 250 jobsEngine_.SetWorkersCount(lock.GetConfiguration().GetUnsignedIntegerParameter("ConcurrentJobs", 2));
251 saveJobs_ = lock.GetConfiguration().GetBooleanParameter("SaveJobs", true);
248 } 252 }
249 253
250 jobsEngine_.SetThreadSleep(unitTesting ? 20 : 200); 254 jobsEngine_.SetThreadSleep(unitTesting ? 20 : 200);
251 255
252 listeners_.push_back(ServerListener(luaListener_, "Lua")); 256 listeners_.push_back(ServerListener(luaListener_, "Lua"));