Skip to content

A package that spawns a worker pool to complete a large list of tasks faster.

License

Notifications You must be signed in to change notification settings

Diego-Paris/go-concurrent-retry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Go Concurrent Retry

Go Concurrent Retry is a project that implements goroutines to execute a large list of tasks quickly.

Spawns a designated amount of worker goroutines that distribute the list of tasks based on their availability, if the task failed the worker will retry upto a designated amount.

Requirements

Go version 1.15.x or higher

For more information about installing Go, visit golang.org/doc/install

Note: May work with older versions but is not guaranteed to function properly.

Installation

git clone https://github.com/Diego-Paris/go-concurrent-retry

Usage

An example using the ConcurrentRetry function

  // Create a list of tasks
  var tasks []func() (string, error)
  for i := 0; i < 20; i++ {
    tasks = append(tasks, coding)
  }

  workers := 3
  retries := 5

  // Returns a channel
  results := ConcurrentRetry(tasks, workers, retries)

  // Collect results from channel until the
  // buffer is empty and successfully closed
  for r := range results {
    fmt.Println("Result received from goroutine:", r)
  }

Contributing

Pull requests are welcome.

License

MIT

About

A package that spawns a worker pool to complete a large list of tasks faster.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages