saving work

This commit is contained in:
Xuu
2020-10-26 12:39:08 -06:00
parent 1a88e47181
commit db4ac49a49
9 changed files with 93 additions and 221 deletions

View File

@@ -120,7 +120,9 @@ func (tr *Runner) Run(key Key, fn Fn, opts ...Option) *qTask {
tr.queue[key.Key()] = task
tr.mu.Unlock()
log.Debug("Waiting for limiter")
tr.limiter.Take()
log.Debug("Got tag from limiter")
go func() {
defer func() {
@@ -156,7 +158,7 @@ func NewRunner(ctx context.Context, defaultOpts ...Option) *Runner {
ctx: ctx,
cancel: cancel,
pause: make(chan struct{}),
limiter: ratelimit.New(1),
limiter: ratelimit.New(10),
}
return tr