Skip to content

Commit

Permalink
update trier
Browse files Browse the repository at this point in the history
  • Loading branch information
da440dil committed Aug 28, 2019
1 parent 9ad6371 commit 234e6ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion examples/counter-with-retry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ func main() {
for i := 1; i < 4; i++ {
// Execute function
if err = t.Try(fn(i)); err != nil {
panic(err)
if e, ok := err.(trier.TTLError); ok {
fmt.Printf("Number of retries with counter #%v exceeded, retry after %v\n", i, e.TTL())
} else {
panic(err)
}
}
}
// Output:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.12

require (
github.com/da440dil/go-ticker v0.0.0
github.com/da440dil/go-trier v0.0.1
github.com/da440dil/go-trier v0.0.2
github.com/go-redis/redis v6.15.2+incompatible
github.com/golang/protobuf v1.3.2 // indirect
github.com/kr/pretty v0.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/da440dil/go-ticker v0.0.0 h1:sH/YeYf//tylK2fShGZi2IQRdtFd/YQgiCnOY2CnTNQ=
github.com/da440dil/go-ticker v0.0.0/go.mod h1:Ia+nQQeharuhnq/NYri4BrU0kVlU/nsmhHY8+65O3lE=
github.com/da440dil/go-trier v0.0.1 h1:plGC/S++x1ZlNjqI+uv8t/32P3TrNY6ddd57cIaxHdU=
github.com/da440dil/go-trier v0.0.1/go.mod h1:Xc70OohXdJvxPLfUDjJG3TeOiitY7K4jx+Q0tm5dIy0=
github.com/da440dil/go-trier v0.0.2 h1:9NLmR83u9IKIy2/xszUyzL4u82Z/83fZZxggY8jTcF4=
github.com/da440dil/go-trier v0.0.2/go.mod h1:Xc70OohXdJvxPLfUDjJG3TeOiitY7K4jx+Q0tm5dIy0=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down

0 comments on commit 234e6ca

Please sign in to comment.