summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCynthia Revström <me@cynthia.re>2020-04-23 13:35:56 +0200
committerCynthia Revström <me@cynthia.re>2020-04-23 13:35:56 +0200
commitbb0a0f702c8a679f25505ce1bd2cc6a59993ff40 (patch)
tree0ffcb62d44758cd4ccf155e8ee43b2eda1e62326
parente3e5d1e5f8e0178ca075ec0c744e358087ebed50 (diff)
don't wait for execution to finishHEADmaster
-rw-r--r--main.go15
1 files 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 {