Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp Thu Aug 07 10:21:43 2014 +0200 +++ b/OrthancServer/ServerIndex.cpp Thu Aug 07 10:51:35 2014 +0200 @@ -252,18 +252,21 @@ void ServerIndex::FlushThread(ServerIndex* that) { - unsigned int sleep; + // By default, wait for 10 seconds before flushing + unsigned int sleep = 10; try { boost::mutex::scoped_lock lock(that->mutex_); std::string sleepString = that->db_->GetGlobalProperty(GlobalProperty_FlushSleep); - sleep = boost::lexical_cast<unsigned int>(sleepString); + + if (Toolbox::IsInteger(sleepString)) + { + sleep = boost::lexical_cast<unsigned int>(sleepString); + } } catch (boost::bad_lexical_cast&) { - // By default, wait for 10 seconds before flushing - sleep = 10; } LOG(INFO) << "Starting the database flushing thread (sleep = " << sleep << ")";