# HG changeset patch # User Sebastien Jodogne # Date 1632398285 -7200 # Node ID 03157465f6f464d5c533af7972172a2e3c6aced4 # Parent d9951c2e0bacb0ae58330f3f4fb1114dc4a40863 added "Interval" configuration option diff -r d9951c2e0bac -r 03157465f6f4 Sources/Plugin.cpp --- a/Sources/Plugin.cpp Thu Sep 23 13:43:11 2021 +0200 +++ b/Sources/Plugin.cpp Thu Sep 23 13:58:05 2021 +0200 @@ -36,7 +36,7 @@ static std::list folders_; static IndexerDatabase database_; static std::unique_ptr storageArea_; - +static unsigned int intervalSeconds_; static bool ComputeInstanceId(std::string& instanceId, @@ -183,7 +183,7 @@ } -static void MonitorDirectories(bool* stop) +static void MonitorDirectories(bool* stop, unsigned int intervalSeconds) { for (;;) { @@ -265,7 +265,7 @@ LOG(ERROR) << e.What(); } - for (unsigned int i = 0; i < /*100*/10; i++) + for (unsigned int i = 0; i < intervalSeconds * 10; i++) { if (*stop) { @@ -424,7 +424,7 @@ { case OrthancPluginChangeType_OrthancStarted: stop_ = false; - thread_ = boost::thread(MonitorDirectories, &stop_); + thread_ = boost::thread(MonitorDirectories, &stop_, intervalSeconds_); break; case OrthancPluginChangeType_OrthancStopped: @@ -478,7 +478,10 @@ static const char* const INDEX_DIRECTORY = "IndexDirectory"; static const char* const ORTHANC_STORAGE = "OrthancStorage"; static const char* const STORAGE_DIRECTORY = "StorageDirectory"; + static const char* const INTERVAL = "Interval"; + intervalSeconds_ = indexer.GetUnsignedIntegerValue(INTERVAL, 10 /* 10 seconds by default */); + if (!indexer.LookupListOfStrings(folders_, FOLDERS, true) || folders_.empty()) {