diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-28 05:35:40 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-28 05:35:40 +0300 |
commit | 536451f648bce43aa34e90a9154adf831027dae7 (patch) | |
tree | 36c66093319e3972f97a141c68e332e25d468331 /telegram/handlers.go | |
parent | fdc8397b93ed355cb931646f0c4eda496ce0e858 (diff) |
Make the chats/users cache thread-safe
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r-- | telegram/handlers.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go index aea1844..c79f765 100644 --- a/telegram/handlers.go +++ b/telegram/handlers.go @@ -108,7 +108,7 @@ func (c *Client) updateHandler() { // new user discovered func (c *Client) updateUser(update *client.UpdateUser) { - c.cache.users[update.User.Id] = update.User + c.cache.SetUser(update.User.Id, update.User) show, status := c.userStatusToText(update.User.Status) go c.processStatusUpdate(int64(update.User.Id), status, show) } @@ -133,7 +133,7 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) { } } - c.cache.chats[update.Chat.Id] = update.Chat + c.cache.SetChat(update.Chat.Id, update.Chat) var isChannel = false if update.Chat.Type.ChatTypeType() == client.TypeChatTypeSupergroup { |