Merge pull request #538 from fbbdev/patch-1

Close hanging channel in ListenForWebhookRespReqFormat
bot-api-6.1
Syfaro 2022-10-19 20:31:55 -04:00 committed by GitHub
commit 2fa77043ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

3
bot.go
View File

@ -493,6 +493,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()})
@ -503,7 +505,6 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.
}
ch <- *update
close(ch)
}(w, r)
return ch