comparison Plugin/PluginContext.cpp @ 55:b09adb6aa199

new PeerConnectivityTimeout configuration
author Alain Mazy <am@osimis.io>
date Mon, 06 Feb 2023 09:17:36 +0100
parents 44a0430d7899
children 1e396fb509ca
comparison
equal deleted inserted replaced
54:5915547fa6f2 55:b09adb6aa199
27 { 27 {
28 PluginContext::PluginContext(size_t threadsCount, 28 PluginContext::PluginContext(size_t threadsCount,
29 size_t targetBucketSize, 29 size_t targetBucketSize,
30 size_t maxPushTransactions, 30 size_t maxPushTransactions,
31 size_t memoryCacheSize, 31 size_t memoryCacheSize,
32 unsigned int maxHttpRetries) : 32 unsigned int maxHttpRetries,
33 unsigned int peerConnectivityTimeout) :
33 pushTransactions_(maxPushTransactions), 34 pushTransactions_(maxPushTransactions),
34 semaphore_(threadsCount), 35 semaphore_(threadsCount),
35 pluginUuid_(Orthanc::Toolbox::GenerateUuid()), 36 pluginUuid_(Orthanc::Toolbox::GenerateUuid()),
36 threadsCount_(threadsCount), 37 threadsCount_(threadsCount),
37 targetBucketSize_(targetBucketSize), 38 targetBucketSize_(targetBucketSize),
38 maxHttpRetries_(maxHttpRetries) 39 maxHttpRetries_(maxHttpRetries),
40 peerConnectivityTimeout_(peerConnectivityTimeout)
39 { 41 {
40 cache_.SetMaxMemorySize(memoryCacheSize); 42 cache_.SetMaxMemorySize(memoryCacheSize);
41 43
42 LOG(INFO) << "Transfers accelerator will use " << threadsCount_ << " thread(s) to run HTTP queries"; 44 LOG(INFO) << "Transfers accelerator will use " << threadsCount_ << " thread(s) to run HTTP queries";
43 LOG(INFO) << "Transfers accelerator will use keep local DICOM files in a memory cache of size: " 45 LOG(INFO) << "Transfers accelerator will keep local DICOM files in a memory cache of size: "
44 << OrthancPlugins::ConvertToMegabytes(memoryCacheSize) << " MB"; 46 << OrthancPlugins::ConvertToMegabytes(memoryCacheSize) << " MB";
45 LOG(INFO) << "Transfers accelerator will aim at HTTP queries of size: " 47 LOG(INFO) << "Transfers accelerator will aim at HTTP queries of size: "
46 << OrthancPlugins::ConvertToKilobytes(targetBucketSize_) << " KB"; 48 << OrthancPlugins::ConvertToKilobytes(targetBucketSize_) << " KB";
47 LOG(INFO) << "Transfers accelerator will be able to receive up to " 49 LOG(INFO) << "Transfers accelerator will be able to receive up to "
48 << maxPushTransactions << " push transaction(s) at once"; 50 << maxPushTransactions << " push transaction(s) at once";
49 LOG(INFO) << "Transfers accelerator will retry " 51 LOG(INFO) << "Transfers accelerator will retry "
50 << maxHttpRetries_ << " time(s) if some HTTP query fails"; 52 << maxHttpRetries_ << " time(s) if some HTTP query fails";
53 LOG(INFO) << "Transfers accelerator will use "
54 << peerConnectivityTimeout_ << " seconds as a timeout when checking peers connectivity";
51 } 55 }
52 56
53 57
54 std::unique_ptr<PluginContext>& PluginContext::GetSingleton() 58 std::unique_ptr<PluginContext>& PluginContext::GetSingleton()
55 { 59 {
60 64
61 void PluginContext::Initialize(size_t threadsCount, 65 void PluginContext::Initialize(size_t threadsCount,
62 size_t targetBucketSize, 66 size_t targetBucketSize,
63 size_t maxPushTransactions, 67 size_t maxPushTransactions,
64 size_t memoryCacheSize, 68 size_t memoryCacheSize,
65 unsigned int maxHttpRetries) 69 unsigned int maxHttpRetries,
70 unsigned int peerConnectivityTimeout)
66 { 71 {
67 GetSingleton().reset(new PluginContext(threadsCount, targetBucketSize, 72 GetSingleton().reset(new PluginContext(threadsCount, targetBucketSize,
68 maxPushTransactions, memoryCacheSize, maxHttpRetries)); 73 maxPushTransactions, memoryCacheSize, maxHttpRetries, peerConnectivityTimeout));
69 } 74 }
70 75
71 76
72 PluginContext& PluginContext::GetInstance() 77 PluginContext& PluginContext::GetInstance()
73 { 78 {