Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.
/ retry-go Public archive

Retry a function execution with specific intervals with panic recovery

License

Notifications You must be signed in to change notification settings

txgruppi/retry-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Retry a function execution with specific intervals with panic recovery

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published