retry

package module
Version: v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2015 License: BSD-2-Clause Imports: 8 Imported by: 0

README

goworker-retry

GoDoc

Retry strategy for use with Resque and goworker.

Installation

go get github.com/everalbum/goworker-retry

Usage

package main

import (
  "github.com/everalbum/goworker"
  "github.com/everalbum/goworker-retry"
)

func main() {
  myJob := "MyJob"
  retryWorker := retry.NewBackoff(myJob, myWorker)

  // Override default settings...
  retryWorker.RetryLimit = 6
  retryWorker.BackoffStrategy = []int{0, 60, 600, 3600, 10800, 21600} // 0s, 1m, 10m, 1h, 3h, 6h

  goworker.Register(myJob, retryWorker.WorkerFunc())

  if err := goworker.Work(); err != nil {
    fmt.Println("Error:", err)
  }
}

func myWorker(queue string, args ...interface{}) error {
  // Do work...
  return nil
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBackoff

func NewBackoff(jobName string, workerFunc func(string, ...interface{}) error) *backoff

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL