diff Framework/PullMode/PullJob.cpp @ 10:c9e28e31262e

new option: MaxHttpRetries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Mar 2019 15:26:49 +0100
parents 7e207ade2f1a
children b06103a50c95
line wrap: on
line diff
--- a/Framework/PullMode/PullJob.cpp	Mon Dec 24 13:45:31 2018 +0100
+++ b/Framework/PullMode/PullJob.cpp	Mon Mar 04 15:26:49 2019 +0100
@@ -101,7 +101,8 @@
       scheduler.ComputePullBuckets(buckets, job.targetBucketSize_, 2 * job.targetBucketSize_,
                                    baseUrl, job.query_.GetCompression());
       area_.reset(new DownloadArea(scheduler));
-        
+
+      queue_.SetMaxRetries(job.maxHttpRetries_);
       queue_.Reserve(buckets.size());
         
       for (size_t i = 0; i < buckets.size(); i++)
@@ -171,7 +172,7 @@
       const std::string lookup = writer.write(job_.query_.GetResources()); 
 
       Json::Value answer;
-      if (!job_.peers_.DoPost(answer, job_.peerIndex_, URI_LOOKUP, lookup))
+      if (!DoPostPeer(answer, job_.peers_, job_.peerIndex_, URI_LOOKUP, lookup, job_.maxHttpRetries_))
       {
         LOG(ERROR) << "Cannot retrieve the list of instances to pull from peer \"" 
                    << job_.query_.GetPeer()
@@ -230,11 +231,13 @@
     
   PullJob::PullJob(const TransferQuery& query,
                    size_t threadsCount,
-                   size_t targetBucketSize) :
+                   size_t targetBucketSize,
+                   unsigned int maxHttpRetries) :
     StatefulOrthancJob(JOB_TYPE_PULL),
     query_(query),
     threadsCount_(threadsCount),
-    targetBucketSize_(targetBucketSize)
+    targetBucketSize_(targetBucketSize),
+    maxHttpRetries_(maxHttpRetries)
   {
     if (!peers_.LookupName(peerIndex_, query_.GetPeer()))
     {