English 中文(简体)
怎样做“保证——最大时间<秒>的工作?
原标题:How does "curl --retry-max-time <seconds>" work?
  • 时间:2012-05-13 00:36:18
  •  标签:
  • curl

I don t know how --retry-max-time calculated. If I download a file file.txt:

curl --max-time 10 --retry 3 --retry-delay 5 --retry-max-time 32  http://www.site.com/download/file.txt 

  • [ 0- 2] It takes 2s to download 50% of the file, and no speed any more.
  • [ 2-10] It waits for another 8s, still no speed, timeout, will retry
  • [10-15] It waits for 5s before retry #1
  • [15-25] Still no speed, will retry
  • [25-30] It waits for 5s before retry #2
  • [30-34] It takes 4s to download 33% of the file, and no speed any more.
  • [34-40] It waits for another 6s, still no speed, timeout

curl 此时此点的停业(40s)?

何时开始并停止<代码>检索时间/代码>?


   --retry-max-time <seconds>
          The  retry  timer  is reset before the first transfer attempt. Retries will be done as usual (see --retry) as
          long as the timer hasn t reached this given limit. Notice that if the timer hasn t  reached  the  limit,  the
          request  will be made and while performing, it may take longer than this given time period. To limit a single
          request´s maximum time, use -m, --max-time.  Set this option to  zero  to  not  timeout  retries.  (Added  in
          7.12.3)
最佳回答

让我努力澄清。

当曲线决定做一次重整时(because --retry)。 使用,条件允许进行再工业,以及<代码>-Rery-maxtime。 如果操作开始后的全部时间超过-retry-max-time,则进行曲线检查。 如果它有吨位,它将允许再做一次回家。

因此,按照上列的指挥线:如果总时间不到32秒,那么它就会做另一回事。 如果总时间超过32秒,则不会再做任何改动。

问题回答
curl --connect-timeout 5 
     --max-time 10 
     --retry 5 
     --retry-delay 0 
     --retry-max-time 60 
      http://www.site.com/download/file.txt 

|<---0---->| {<---1---->|  |<---2---->|    |<---3---->|   |<---4---->|   }            |<---5---->|
|....==    | {...==     |  |....==    |    |.....|        |..=== =   |   }
             {                                                           }

NOTATION

=====  downloading...       (file size is 5)
.....  --connect-timeout 5
|<->|  --max-time 10
<-5->  --retry 5
>| |<  --retry-delay 0      ([default] exp backoff algo)
{   }  --retry-max-time 60  (GAME OVER)

NOTE

  • retry delay 1, 2, 4, 8 ...
  • retry #3 connect timeout
  • retry #5 never happen
  • download failed at END (71 sec)




相关问题
curl + sessions

I m making POST requests with CURL, and I would like to output cookies made during that request... Is that possible? :)

Curl setting Content-Type incorrectly

I am running a curl operation on the command line and am having trouble forcing the header to set as XML. I use the -H option to force the Content-Type to be xml, however, once I run the command I can ...

Create new etherpad using PHP and CURL

I m trying to write a simple PHP script which automatically sets up new etherpads (see http://etherpad.com/). They don t have an API (yet) for creating new pads so I m trying to figure if I can do ...

Finding out where curl was redirected

I m using curl to make php send an http request to some website somewhere and have set CURLOPT_FOLLOWLOCATION to 1 so that it follows redirects. How then, can I find out where it was eventually ...

热门标签