Keep goroutine count down by not starting work for things where the caller gave up

This commit is contained in:
Neil Alexander 2021-07-05 11:10:37 +01:00
parent c1655736dd
commit 59b1df09e5
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -368,7 +368,10 @@ func (t *inputWorker) run() {
return
default:
evStart := time.Now()
task.err = task.t.processEvent(task.ctx, task.event)
// TODO: Is 5 minutes too long?
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)
task.err = task.t.processEvent(ctx, task.event)
cancel()
task.duration = time.Since(evStart)
if err := task.err; err != nil {
switch err.(type) {