Close hanging channel in ListenForWebhookRespReqFormat
parent
537c005643
commit
2e8be8df9f
3
bot.go
3
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
|
||||
|
|
Loading…
Reference in New Issue