comparison OrthancServer/ServerIndex.cpp @ 1102:ce6386b37afd

avoid unnecessary exceptions on Orthanc startup
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 Aug 2014 10:51:35 +0200
parents 649d47854314
children ba5c0908600c
comparison
equal deleted inserted replaced
1101:e5686a703c63 1102:ce6386b37afd
250 } 250 }
251 251
252 252
253 void ServerIndex::FlushThread(ServerIndex* that) 253 void ServerIndex::FlushThread(ServerIndex* that)
254 { 254 {
255 unsigned int sleep; 255 // By default, wait for 10 seconds before flushing
256 unsigned int sleep = 10;
256 257
257 try 258 try
258 { 259 {
259 boost::mutex::scoped_lock lock(that->mutex_); 260 boost::mutex::scoped_lock lock(that->mutex_);
260 std::string sleepString = that->db_->GetGlobalProperty(GlobalProperty_FlushSleep); 261 std::string sleepString = that->db_->GetGlobalProperty(GlobalProperty_FlushSleep);
261 sleep = boost::lexical_cast<unsigned int>(sleepString); 262
263 if (Toolbox::IsInteger(sleepString))
264 {
265 sleep = boost::lexical_cast<unsigned int>(sleepString);
266 }
262 } 267 }
263 catch (boost::bad_lexical_cast&) 268 catch (boost::bad_lexical_cast&)
264 { 269 {
265 // By default, wait for 10 seconds before flushing
266 sleep = 10;
267 } 270 }
268 271
269 LOG(INFO) << "Starting the database flushing thread (sleep = " << sleep << ")"; 272 LOG(INFO) << "Starting the database flushing thread (sleep = " << sleep << ")";
270 273
271 unsigned int count = 0; 274 unsigned int count = 0;