server.New signature changes and test fixes. (#324)

* ctx middleware should always be the first added to router

* plugable enqueue func, changed server.New signature

* fix tests

* remove ctx/ctx.Done from server
This commit is contained in:
Pedro Nasser
2016-11-21 14:11:01 -02:00
committed by C Cirello
parent bc0f0c8b42
commit 0343c4990c
9 changed files with 52 additions and 58 deletions

View File

@@ -176,8 +176,9 @@ func (s *Server) handleRequest(c *gin.Context, enqueue models.Enqueue) {
task.EnvVars = cfg.Env
task.Payload = string(pl)
// Push to queue
enqueue(task)
enqueue(ctx, s.MQ, task)
log.Info("Added new task to queue")
c.JSON(http.StatusAccepted, map[string]string{"call_id": task.ID})
default: