Make status updates asynchronous

This commit is contained in:
bodqhrohro 2019-12-21 04:16:43 +02:00
parent 7a2e355111
commit 915b7fe1de

View file

@ -110,13 +110,13 @@ func (c *Client) updateHandler() {
func (c *Client) updateUser(update *client.UpdateUser) {
c.cache.users[update.User.Id] = update.User
show, status := c.userStatusToText(update.User.Status)
c.processStatusUpdate(int64(update.User.Id), status, show)
go c.processStatusUpdate(int64(update.User.Id), status, show)
}
// user status changed
func (c *Client) updateUserStatus(update *client.UpdateUserStatus) {
show, status := c.userStatusToText(update.Status)
c.processStatusUpdate(int64(update.UserId), status, show, gateway.SPImmed(false))
go c.processStatusUpdate(int64(update.UserId), status, show, gateway.SPImmed(false))
}
// new chat discovered
@ -155,7 +155,7 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
}
if update.Chat.Id < 0 {
c.processStatusUpdate(update.Chat.Id, update.Chat.Title, "chat")
go c.processStatusUpdate(update.Chat.Id, update.Chat.Title, "chat")
}
}