Skip to content

Multiple backoff algorithms exposed as a service in Go (Golang)

License

Notifications You must be signed in to change notification settings

stephnr/backoff

Repository files navigation

Backoff

Travis Coverage Status Godoc Go Report Card

A package for Optimistic Concurrency Control

Summary

This project is an improvement of the backoff package implemented by cenkalti/backoff. This package provides support for various other backoff algorithms and exposes them in a service-like fashion for use.

Backoff Algorithms such as Exponential Backoff are all part of a branch of computer science known as “Optimistic Concurrency Control”. The focus of these algorithms is to use feedback cycles and process staggering to determine an acceptable time at which a process can successfully complete its intended goal.

Supported Algorithms:

  • Exponential Backoff
  • Fibonacci (TBD)
  • Equal Jitter (TBD)
  • Full Jitter (TBD)
  • Decorr (TBD)
  • Custom Backoff (TBD)

Installation & Usage

To install backoff, use go get:

go get github.com/defaltd/backoff

Import the backoff package into your code using this template:

package main

import (
    "fmt"
    "backoff"
)

func SayHello() {
    service := backoff.New(&backoff.Policy{
        Algorithm: backoff.AlgorithmExponential,
    })

    service.ExecuteAction(func() error { return client.MakeAPICall("Hello World"); })
}

Contributing

Please feel free to contribute by submitting issues, fork the repository and send pull requests!

When submitting an issue, we ask that you please include a complete test function that demonstrates the issue.

About

Multiple backoff algorithms exposed as a service in Go (Golang)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages