Mercurial > hg > orthanc-transfers
changeset 55:b09adb6aa199
new PeerConnectivityTimeout configuration
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 06 Feb 2023 09:17:36 +0100 |
parents | 5915547fa6f2 |
children | 5480f176b282 |
files | NEWS Plugin/Plugin.cpp Plugin/PluginContext.cpp Plugin/PluginContext.h |
diffstat | 4 files changed, 27 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Fri Feb 03 18:44:53 2023 +0100 +++ b/NEWS Mon Feb 06 09:17:36 2023 +0100 @@ -4,7 +4,9 @@ => Minimum SDK version: 1.11.3 <= * updated to Orthanc Framework and SDK 1.11.3 - +* new "PeerConnectivityTimeout" configuration to configure the HTTP Timeout when checking + if a remote peer has the transfer plugin enabled in /transfers/peers GET route. + Default value is 2 which was the hardcoded default value in previous versions. Version 1.3 (2022-11-30) ========================
--- a/Plugin/Plugin.cpp Fri Feb 03 18:44:53 2023 +0100 +++ b/Plugin/Plugin.cpp Mon Feb 06 09:17:36 2023 +0100 @@ -579,7 +579,7 @@ OrthancPlugins::DetectTransferPlugin::Result detection; OrthancPlugins::DetectTransferPlugin::Apply - (detection, context.GetThreadsCount(), 2 /* timeout */); + (detection, context.GetThreadsCount(), context.GetPeerConnectivityTimeout()); Json::Value result = Json::objectValue; @@ -649,6 +649,7 @@ size_t maxPushTransactions = 4; size_t memoryCacheSize = 512; // In MB unsigned int maxHttpRetries = 0; + unsigned int peerConnectivityTimeout = 2; { OrthancPlugins::OrthancConfiguration config; @@ -663,11 +664,12 @@ memoryCacheSize = plugin.GetUnsignedIntegerValue("CacheSize", memoryCacheSize); maxPushTransactions = plugin.GetUnsignedIntegerValue("MaxPushTransactions", maxPushTransactions); maxHttpRetries = plugin.GetUnsignedIntegerValue("MaxHttpRetries", maxHttpRetries); + peerConnectivityTimeout = plugin.GetUnsignedIntegerValue("PeerConnectivityTimeout", peerConnectivityTimeout); } } OrthancPlugins::PluginContext::Initialize(threadsCount, targetBucketSize * KB, maxPushTransactions, - memoryCacheSize * MB, maxHttpRetries); + memoryCacheSize * MB, maxHttpRetries, peerConnectivityTimeout); OrthancPlugins::RegisterRestCallback<ServeChunks> (std::string(URI_CHUNKS) + "/([.0-9a-f-]+)", true);
--- a/Plugin/PluginContext.cpp Fri Feb 03 18:44:53 2023 +0100 +++ b/Plugin/PluginContext.cpp Mon Feb 06 09:17:36 2023 +0100 @@ -29,18 +29,20 @@ size_t targetBucketSize, size_t maxPushTransactions, size_t memoryCacheSize, - unsigned int maxHttpRetries) : + unsigned int maxHttpRetries, + unsigned int peerConnectivityTimeout) : pushTransactions_(maxPushTransactions), semaphore_(threadsCount), pluginUuid_(Orthanc::Toolbox::GenerateUuid()), threadsCount_(threadsCount), targetBucketSize_(targetBucketSize), - maxHttpRetries_(maxHttpRetries) + maxHttpRetries_(maxHttpRetries), + peerConnectivityTimeout_(peerConnectivityTimeout) { cache_.SetMaxMemorySize(memoryCacheSize); LOG(INFO) << "Transfers accelerator will use " << threadsCount_ << " thread(s) to run HTTP queries"; - LOG(INFO) << "Transfers accelerator will use keep local DICOM files in a memory cache of size: " + LOG(INFO) << "Transfers accelerator will keep local DICOM files in a memory cache of size: " << OrthancPlugins::ConvertToMegabytes(memoryCacheSize) << " MB"; LOG(INFO) << "Transfers accelerator will aim at HTTP queries of size: " << OrthancPlugins::ConvertToKilobytes(targetBucketSize_) << " KB"; @@ -48,6 +50,8 @@ << maxPushTransactions << " push transaction(s) at once"; LOG(INFO) << "Transfers accelerator will retry " << maxHttpRetries_ << " time(s) if some HTTP query fails"; + LOG(INFO) << "Transfers accelerator will use " + << peerConnectivityTimeout_ << " seconds as a timeout when checking peers connectivity"; } @@ -62,10 +66,11 @@ size_t targetBucketSize, size_t maxPushTransactions, size_t memoryCacheSize, - unsigned int maxHttpRetries) + unsigned int maxHttpRetries, + unsigned int peerConnectivityTimeout) { GetSingleton().reset(new PluginContext(threadsCount, targetBucketSize, - maxPushTransactions, memoryCacheSize, maxHttpRetries)); + maxPushTransactions, memoryCacheSize, maxHttpRetries, peerConnectivityTimeout)); }
--- a/Plugin/PluginContext.h Fri Feb 03 18:44:53 2023 +0100 +++ b/Plugin/PluginContext.h Mon Feb 06 09:17:36 2023 +0100 @@ -42,12 +42,14 @@ size_t threadsCount_; size_t targetBucketSize_; unsigned int maxHttpRetries_; + unsigned int peerConnectivityTimeout_; PluginContext(size_t threadsCount, size_t targetBucketSize, size_t maxPushTransactions, size_t memoryCacheSize, - unsigned int maxHttpRetries); + unsigned int maxHttpRetries, + unsigned int peerConnectivityTimeout); static std::unique_ptr<PluginContext>& GetSingleton(); @@ -87,11 +89,17 @@ return maxHttpRetries_; } + unsigned int GetPeerConnectivityTimeout() const + { + return peerConnectivityTimeout_; + } + static void Initialize(size_t threadsCount, size_t targetBucketSize, size_t maxPushTransactions, size_t memoryCacheSize, - unsigned int maxHttpRetries); + unsigned int maxHttpRetries, + unsigned int peerConnectivityTimeout); static PluginContext& GetInstance();