"是如何工作的?-6ren"> "是如何工作的?-我不知道--retry-max-time是如何计算的。如果我下载文件 file.txt: curl --max-time 10 --retry 3 --retry-delay 5 --retry-ma-6ren">
gpt4 book ai didi

curl - "curl --retry-max-time "是如何工作的?

转载 作者:行者123 更新时间:2023-12-02 03:59:09 25 4
gpt4 key购买 nike

我不知道--retry-max-time是如何计算的。如果我下载文件 file.txt:

curl --max-time 10 --retry 3 --retry-delay 5 --retry-max-time 32 'http://www.site.com/download/file.txt'
<小时/>
  • [ 0- 2] 下载50%文件需要2s,并且不再速度。
  • [2-10]再等待8s,仍然没有速度,超时,将重试
  • [10-15] 在重试 #1 之前等待 5s
  • [15-25]仍然没有速度,将重试
  • [25-30] 在重试 #2 之前等待 5s
  • [30-34] 下载 33% 文件需要 4 秒,而且速度已经没有了。
  • [34-40]又等了6s,还是没速度,超时

此时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)

最佳答案

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---->|
|....== | {...== | |....== | |.....| |..=== = | }
{ }

符号

=====  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)

注意

  • 重试延迟 1、2、4、8 ...
  • 重试 #3 连接超时
  • 重试 #5 永远不会发生
  • 下载在结束时失败(71 秒)

关于curl - "curl --retry-max-time <seconds>"是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10568497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com