Skip to content

Commit 2e8be8d

Browse files
authored
Close hanging channel in ListenForWebhookRespReqFormat
1 parent 537c005 commit 2e8be8d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bot.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.
494494
ch := make(chan Update, bot.Buffer)
495495

496496
func(w http.ResponseWriter, r *http.Request) {
497+
defer close(ch)
498+
497499
update, err := bot.HandleUpdate(r)
498500
if err != nil {
499501
errMsg, _ := json.Marshal(map[string]string{"error": err.Error()})
@@ -504,7 +506,6 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.
504506
}
505507

506508
ch <- *update
507-
close(ch)
508509
}(w, r)
509510

510511
return ch

0 commit comments

Comments
 (0)