From bb0a0f702c8a679f25505ce1bd2cc6a59993ff40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cynthia=20Revstr=C3=B6m?= Date: Thu, 23 Apr 2020 13:35:56 +0200 Subject: don't wait for execution to finish --- main.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index e88d655..e12e4dd 100644 --- a/main.go +++ b/main.go @@ -53,10 +53,7 @@ func loadConfig() { } func executeHandler(repoName string) error { - handler, ok := config.Handlers[repoName] - if !ok { - return errors.New("no handler found") - } + handler := config.Handlers[repoName] handler = filepath.Join(*dataPath, handler) @@ -102,13 +99,15 @@ func handleWebhookSrc(rw http.ResponseWriter, req *http.Request) { return } - // Execute the handler for this repo - err = executeHandler(payload.RepoName) - if err != nil { - log.Print(err) + _, ok := config.Handlers[payload.RepoName] + if !ok { + log.Print("handler not found") http.Error(rw, "error", 500) return } + + // Execute the handler for this repo + go executeHandler(payload.RepoName) } func validateTokenHeader(rw http.ResponseWriter, req *http.Request) bool { -- cgit v1.2.3