github.com/mccutchen/speculatively (go): Package speculatively provides a simple mechanism to speculatively execute a task in parallel only after some initial timeout has elapsed.  Example demonstrates use of speculatively.Do to execute an expensive task one or more times in parallel.  Every time the task is executed, it will wait half as long before returning.  Given an operation timeout of 100ms and an initial task latency of 256ms, the first execution of our expensive task will always time out.  Every 20ms, the task will be executed again, until it returns successfully or the timeout expires.  The overall timings of each execution look like this:
Keywords: golang|speculative-execution