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.
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.
git clone https://github.com/Diego-Paris/go-concurrent-retry
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)
}
Pull requests are welcome.