Merge pull request #538 from fbbdev/patch-1
Close hanging channel in ListenForWebhookRespReqFormatbot-api-6.1
commit
2fa77043ad
3
bot.go
3
bot.go
|
@ -493,6 +493,8 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.
|
||||||
ch := make(chan Update, bot.Buffer)
|
ch := make(chan Update, bot.Buffer)
|
||||||
|
|
||||||
func(w http.ResponseWriter, r *http.Request) {
|
func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
update, err := bot.HandleUpdate(r)
|
update, err := bot.HandleUpdate(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg, _ := json.Marshal(map[string]string{"error": err.Error()})
|
errMsg, _ := json.Marshal(map[string]string{"error": err.Error()})
|
||||||
|
@ -503,7 +505,6 @@ func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- *update
|
ch <- *update
|
||||||
close(ch)
|
|
||||||
}(w, r)
|
}(w, r)
|
||||||
|
|
||||||
return ch
|
return ch
|
||||||
|
|
Loading…
Reference in New Issue