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

@@ -76,7 +76,8 @@ func TestRouteRunnerAsyncExecution(t *testing.T) {
wg.Add(1)
fmt.Println("About to start router")
router := testRouterAsync(ds, mq, testRunner(t), tasks, func(_ context.Context, _ models.MessageQueue, task *models.Task) (*models.Task, error) {
rnr, cancel := testRunner(t)
router := testRouterAsync(ds, mq, rnr, tasks, func(_ context.Context, _ models.MessageQueue, task *models.Task) (*models.Task, error) {
if test.body != task.Payload {
t.Errorf("Test %d: Expected task Payload to be the same as the test body", i)
}
@@ -109,5 +110,6 @@ func TestRouteRunnerAsyncExecution(t *testing.T) {
}
wg.Wait()
cancel()
}
}