func gondolaRunTasksHandler(ctx *app.Context) { if ctx.GetHeader("X-Appengine-Cron") != "true" { ctx.Forbidden("") return } pendingTasks.Lock() for _, v := range pendingTasks.tasks { task := v ctx.Go(func(c *app.Context) { if _, err := executeTask(c, task); err != nil { ctx.Logger().Error(err) } }) } pendingTasks.tasks = nil pendingTasks.Unlock() ctx.Wait() }