【文件属性】:
文件名称:retry:Go的简单易用的重试机制包
文件大小:6KB
文件格式:ZIP
更新时间:2021-05-27 11:23:46
retry goretry retry-go retry-mechanism Go
重试
Go的简单易用的重试机制包
安装
使用以下方法安装软件包
$ go get github . com / thedevsaddam / retry
用法
要使用该软件包,请将其导入您的*.go代码中
import "github.com/thedevsaddam/retry"
例子
只需重试一个函数,以1秒的间隔执行最多10次
package main
import (
"fmt"
"time"
"github.com/thedevsaddam/retry"
)
func main () {
i := 1 // lets assume we expect i to be a value of 8
err := retry . DoFunc ( 10 , 1 * time . Second , func () error {
fmt . Printf ( "tryi
【文件预览】:
retry-master
----go.mod(46B)
----LICENSE.md(1KB)
----.travis.yml(442B)
----CONTRIBUTING.md(559B)
----retry.go(3KB)
----README.md(2KB)
----retry_test.go(3KB)