用法:
retry(f;  delays=ExponentialBackOff(), check=nothing) -> Function返回一个调用函数 f 的匿名函数。如果出现异常,则在等待 delays 中指定的秒数后,再次重复调用 f ,每次 check 返回 true 。 check 应输入 delays 的当前状态和 Exception 。
Julia 1.2
在 Julia 1.2 之前,此签名仅限于 f::Function 。
例子
retry(f, delays=fill(5.0, 3))
retry(f, delays=rand(5:10, 2))
retry(f, delays=Base.ExponentialBackOff(n=3, first_delay=5, max_delay=1000))
retry(http_get, check=(s,e)->e.status == "503")(url)
retry(read, check=(s,e)->isa(e, IOError))(io, 128; all=false)相关用法
- Julia rem用法及代码示例
- Julia reduce方法用法及代码示例
- Julia redirect_stdio用法及代码示例
- Julia readchomp用法及代码示例
- Julia readuntil用法及代码示例
- Julia replace!用法及代码示例
- Julia real方法用法及代码示例
- Julia readlines用法及代码示例
- Julia replace()用法及代码示例
- Julia read用法及代码示例
- Julia reverseind用法及代码示例
- Julia reim用法及代码示例
- Julia repeat方法用法及代码示例
- Julia readline用法及代码示例
- Julia repeat用法及代码示例
- Julia repr方法用法及代码示例
- Julia reverse!用法及代码示例
- Julia reshape用法及代码示例
- Julia replace方法用法及代码示例
- Julia repeat()用法及代码示例
- Julia reverse方法用法及代码示例
- Julia resize!用法及代码示例
- Julia readeach用法及代码示例
- Julia reverse()用法及代码示例
- Julia rest用法及代码示例
注:本文由纯净天空筛选整理自julialang.org 大神的英文原创作品 Base.retry — Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
