tideland / go-worker

Handle synchronous and asynchronous tasks enqueued in the background.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a ThrottledWorker

themue opened this issue · comments

  • Add a ThrottledWorker
  • It is created with a Contex, a Limit, and a Burstas arguments
  • Limit is a number of requests per second
  • Burst is the number of requests at a time

Ensure a graceful context shutdown. It has to append a shutdown actionTask and block future input with a shutdown error.

Worker uses a flexible queue as buffer providing a function for input actionTask and a function returning a channel for an iteration pattern.