Skip to content
Retry a function execution with specific intervals with panic recovery
Go Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
doc.go
glide.lock
glide.yaml
retry.go
retry_test.go
test.sh

README.md

GoDoc Codeship Codecov Go Report Card

Retry

Retry a function execution with specific intervals with panic recovery

Make sure to read the docs to understand how this package works and what do expected from it.

Installation

go get -u github.com/txgruppi/retry-go

Example

package main

import (
  "log"
  "time"

  "github.com/txgruppi/retry-go"
)

func main() {
  toTry := func(attempt, limit int) error {
    // Do you stuff and return an error if there is any
    return nil
  }

  err := retry.WithFixedInterval(1 * time.Second, 5, toTry)
  if err != nil {
    log.Fatal(err) // It should log the errors if there were any
  }
}

Tests

go get -u -t github.com/txgruppi/retry-go
cd $GOPATH/src/github.com/txgruppi/retry-go
go test ./...

License

MIT

You can’t perform that action at this time.