Fixed memory leak and made response instant

This commit is contained in:
Artyom Belousov 2019-05-12 11:25:46 +03:00
parent 3ee53b7ad1
commit c59d47326d
3 changed files with 12 additions and 4 deletions

View file

@ -27,12 +27,12 @@ func HandleMessage(c *gin.Context) {
case "confirmation":
handleConfirmation(c, &req)
case "message_new":
handleSearch(c, &req)
go handleSearch(c, &req)
c.String(http.StatusOK, "ok")
}
}
func handleSearch(c *gin.Context, req *MessageRequest) {
defer c.String(http.StatusOK, "ok")
cardName, err := getCardNameByCommand(req.Object.Body)
if err != nil {
Message(req.Object.UserId, "Некорректная команда")