Popularity
1.0
Stable
Activity
0.0
Stable
4
3
0

Description

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. :)

Programming language: Go
Tags: Utilities     Retry     Recover    

Retry alternatives and similar packages

Based on the "Utilities" category.
Alternatively, view Retry alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Retry or a related project?

Add another 'Utilities' Package

README

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


*Note that all licence references and agreements mentioned in the Retry README section above are relevant to that project's source code only.