• Stars
    star
    49
  • Rank 585,874 (Top 12 %)
  • Language
    Go
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Retrying made simple and easy for golang πŸ”

retry-go

  • Retrying made simple and easy for golang.

Installation

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

Usage

Do

package main

import (
  "time"

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

func main() {
  attempts := 3
  sleepTime := time.Second*2
  if err := retry.Do(func() error {
    return work()
  }, attempts, sleepTime); err != nil {
    // Retry failed
  }
}

DoHTTP

package main

import (
  "time"

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

func main() {
  attempts := 3
  sleepTime := time.Second*2
  if err := retry.DoHTTP(func() (*http.Response, error) {
    return makeRequest()
  }, attempts, sleepTime); err != nil {
    // Retry failed
  }
}

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

Badges

Build Status Go Report Card Go Doc


GitHub @rafaeljesus Β Β·Β  Medium @_jesus_rafael Β Β·Β  Twitter @_jesus_rafael

More Repositories

1

rabbus

A tiny wrapper over amqp exchanges and queues 🚌 ✨
Go
97
star
2

nsq-event-bus

A tiny wrapper around NSQ topic and channel πŸš€
Go
79
star
3

parallel-fn

Run functions in parallel β˜„οΈ
Go
36
star
4

cron

Cron like job scheduler
Go
33
star
5

cron_api

Cron-like job scheduler as a service.
Elixir
28
star
6

composing-go-example

Project example demonstrating interface segregation in go
Go
23
star
7

tempdb

Key-value store for temporary items πŸ“
Go
19
star
8

kafka-event-bus

A tiny wrapper around https://github.com/Shopify/sarama topic and consumer 🚌
Go
15
star
9

resilient-go-example

Making HTTP Client more Resilient inΒ Go example
Go
14
star
10

koa-bb

koa2, jwt, knex, ava and docker boilerplate
JavaScript
14
star
11

event-srv

A high performance event log as a service βŒ›
Go
11
star
12

easy-schedule

Flexible job scheduling
JavaScript
11
star
13

crony

Cron scheduler as a service πŸ• 
Go
10
star
14

gridfs-api

Exposes a REST API for MongoDB GridFS
JavaScript
9
star
15

srv-consumer

A recommendation for how a Rabbit consumer service should be designed in Go
Go
9
star
16

bank_ror

Simple Ruby on Rails Bank Account System
Ruby
9
star
17

event_track

Record any actions your system perform, along with any properties that describe the action.
Elixir
8
star
18

event-tracker

[DEPRECATED] This project is deprecated in favor of https://github.com/rafaeljesus/event-srv
Go
7
star
19

agile2go

Rails 4 - Backbone.js - SemanticUI
JavaScript
7
star
20

pagarme-node

Pagarme API http client πŸ’Έ
JavaScript
5
star
21

safe

Thread-safe for any value πŸ”’
Go
5
star
22

url-status-go

A URL status monitoring application
Go
4
star
23

wstats

Natural language TCP server
Go
4
star
24

rest-scheduler

Handles job scheduling by storing and managing events that correspond to actions to execute in the future
JavaScript
3
star
25

emitter

Node.js EventEmitter in Elixir
Elixir
3
star
26

koa-xml

XML request body parser for Koa
JavaScript
3
star
27

rust_cache

RR, MRU, LRU, LFU caches implemented in rust
Rust
2
star
28

newww

The npm website
JavaScript
2
star
29

kyp-env

Kyp Docker Development Environment
2
star
30

docker-mongodb

Dockerfile to build a MongoDB container image
2
star
31

events

Modular microservices in node.js, mongodb, rabbitmq, docker
2
star
32

event-track

Record any actions your system perform, along with any properties that describe the action.
JavaScript
2
star
33

maremar

Real Time App for http://www.maremar.tur.br/
JavaScript
2
star
34

rtrace

Async trace events micro services in ruby
Ruby
2
star
35

events-api

The public Events API
JavaScript
2
star
36

minitail

naive tail command in rust
Rust
2
star
37

kyp-users

Kyp Users API
Go
1
star
38

kyp-todo

Kyp Todo Api
Go
1
star
39

rorder

Orders micro services API
Ruby
1
star
40

wt-track-api

A simple webtask to record any actions your system perform
JavaScript
1
star
41

tags-api

JavaScript
1
star
42

kv

Ridiculous async key value store
Elixir
1
star
43

design-patterns-java

Design Patterns for good Java Developers
Java
1
star
44

gridfs-db

MongoDB GridFS
JavaScript
1
star
45

events-worker

Worker runs your Events logs
JavaScript
1
star
46

survey

Create Surveys with Rails
Ruby
1
star
47

events-core

Events core model and services shared by events api and worker
JavaScript
1
star
48

tracing-rest

[DEPRECATED] This project is deprecated in favor of https://github.com/rafaeljesus/event-srv
Go
1
star
49

event_worker

Consumes a event from rabbitmq and stores on mongodb.
Elixir
1
star
50

ac-api

JavaScript
1
star
51

elb_registrator

Register EC2 instances with an ELB
Elixir
1
star
52

todo

Todo is a sample praxis api server
Ruby
1
star
53

url-status

URL status monitoring application
JavaScript
1
star
54

shipping-api

The simple shipping API
JavaScript
1
star
55

rustbook

code exercises from the https://doc.rust-lang.org
Rust
1
star