functions: fix goroutine leak in runner (#394)

* functions: fix goroutine leak in runner

* functions: ensure taskQueue is consumed after context cancellation
This commit is contained in:
C Cirello
2016-12-06 16:11:06 +01:00
committed by GitHub
parent f0fc85b85a
commit 0cdd1db3e1
9 changed files with 122 additions and 67 deletions

View File

@@ -94,9 +94,13 @@ func TestFullStack(t *testing.T) {
tasks := make(chan task.Request)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go runner.StartWorkers(ctx, testRunner(t), tasks)
router := testRouter(ds, &mqs.Mock{}, testRunner(t), tasks)
rnr, rnrcancel := testRunner(t)
defer rnrcancel()
go runner.StartWorkers(ctx, rnr, tasks)
router := testRouter(ds, &mqs.Mock{}, rnr, tasks)
for _, test := range []struct {
name string