Skip to content

Commit

Permalink
use trier
Browse files Browse the repository at this point in the history
  • Loading branch information
da440dil committed Aug 8, 2019
1 parent d170a29 commit d28d865
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ if v, err := c.Count("key"); err != nil {
- [example](./examples/counter-gateway-default/main.go) usage with default [gateway](./gateway/memory/memory.go)
- [example](./examples/counter-gateway-memory/main.go) usage with memory [gateway](./gateway/memory/memory.go)
- [example](./examples/counter-gateway-redis/main.go) usage with [Redis](https://redis.io) [gateway](./gateway/redis/redis.go)
- [example](./examples/counter-with-retry/main.go) usage with [retry](https://github.com/da440dil/go-runner)
- [example](./examples/counter-with-retry/main.go) usage with [retry](https://github.com/da440dil/go-trier)
14 changes: 7 additions & 7 deletions examples/counter-with-retry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/da440dil/go-counter"
"github.com/da440dil/go-runner"
"github.com/da440dil/go-trier"
)

func main() {
Expand All @@ -14,12 +14,12 @@ func main() {
if err != nil {
panic(err)
}
// Create runner
r, err := runner.New(
// Create trier
t, err := trier.New(
// Set maximum number of retries
runner.WithRetryCount(1),
trier.WithRetryCount(1),
// Set delay between retries
runner.WithRetryDelay(time.Millisecond*40),
trier.WithRetryDelay(time.Millisecond*40),
)
if err != nil {
panic(err)
Expand All @@ -40,8 +40,8 @@ func main() {
}
}
for i := 1; i < 4; i++ {
// Run function
if err = r.Run(fn(i)); err != nil {
// Execute function
if err = t.Try(fn(i)); err != nil {
panic(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/da440dil/go-counter
go 1.12

require (
github.com/da440dil/go-runner v0.0.3
github.com/da440dil/go-trier v0.0.0
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,5 +1,5 @@
github.com/da440dil/go-runner v0.0.3 h1:WWdU7wk1isE3lxuxK1nHc2miO3kUxe0qM+K/8eoCSfU=
github.com/da440dil/go-runner v0.0.3/go.mod h1:iMGPIQI7VouRpfZZbhckqdjJKtPBntxGrvzObqG/oII=
github.com/da440dil/go-trier v0.0.0 h1:cxPHRwg2dKE/ldqPiLGtgql8VUTfvYlI+eF14BY4+I8=
github.com/da440dil/go-trier v0.0.0/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 d28d865

Please sign in to comment.