From 2e8be8df9fceb0faca1e2e177b98871a02b7d817 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Sun, 24 Apr 2022 03:35:19 +0200 Subject: [PATCH] Close hanging channel in ListenForWebhookRespReqFormat --- bot.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot.go b/bot.go index 3c7f953..042af48 100644 --- a/bot.go +++ b/bot.go @@ -494,6 +494,8 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http. ch := make(chan Update, bot.Buffer) func(w http.ResponseWriter, r *http.Request) { + defer close(ch) + update, err := bot.HandleUpdate(r) if err != nil { errMsg, _ := json.Marshal(map[string]string{"error": err.Error()}) @@ -504,7 +506,6 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http. } ch <- *update - close(ch) }(w, r) return ch