Skip to content

Commit

Permalink
Merge pull request #538 from fbbdev/patch-1
Browse files Browse the repository at this point in the history
Close hanging channel in ListenForWebhookRespReqFormat
  • Loading branch information
Syfaro authored Oct 20, 2022
2 parents 00ae020 + 2e8be8d commit 2fa7704
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()})
Expand All @@ -503,7 +505,6 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.
}

ch <- *update
close(ch)
}(w, r)

return ch
Expand Down

0 comments on commit 2fa7704

Please sign in to comment.