aboutsummaryrefslogtreecommitdiff
path: root/telegram/connect.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-28 05:35:40 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-28 05:35:40 +0300
commit536451f648bce43aa34e90a9154adf831027dae7 (patch)
tree36c66093319e3972f97a141c68e332e25d468331 /telegram/connect.go
parentfdc8397b93ed355cb931646f0c4eda496ce0e858 (diff)
Make the chats/users cache thread-safe
Diffstat (limited to 'telegram/connect.go')
-rw-r--r--telegram/connect.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/telegram/connect.go b/telegram/connect.go
index cb9936a..f367370 100644
--- a/telegram/connect.go
+++ b/telegram/connect.go
@@ -135,7 +135,7 @@ func (c *Client) Disconnect() {
log.Warn("Disconnecting from Telegram network...")
// we're offline (unsubscribe if logout)
- for id := range c.cache.chats {
+ for _, id := range c.cache.ChatsKeys() {
gateway.SendPresence(
c.xmpp,
c.jid,
@@ -200,7 +200,7 @@ func (c *Client) interactor() {
Limit: chatsLimit,
})
if err != nil {
- log.Error("Could not retrieve chats")
+ log.Errorf("Could not retrieve chats: %v", err)
}
gateway.SendPresence(c.xmpp, c.jid, gateway.SPStatus("Logged in "+c.Session.Login))