Skip to content

Commit 7dd331d

Browse files
committed
fixed webhook interactions blocking forever
1 parent 2505ff5 commit 7dd331d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

internal/webhook_server.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,12 @@ func (h *webhookInteractionHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
9090
w.WriteHeader(http.StatusBadRequest)
9191
}
9292
c := make(chan interface{})
93-
h.webhookServer.Disgo().EventManager().Handle(api.InteractionCreateWebhookEvent, rawBody, c)
93+
go h.webhookServer.Disgo().EventManager().Handle(api.InteractionCreateWebhookEvent, rawBody, c)
9494

95-
response := <-c
9695
w.WriteHeader(http.StatusOK)
9796
w.Header().Set("Content-Type", "application/json")
9897

99-
err = json.NewEncoder(w).Encode(response)
98+
err = json.NewEncoder(w).Encode(<-c)
10099
if err != nil {
101100
log.Errorf("error writing body: %s", err)
102101
}

0 commit comments

Comments
 (0)