Archived
1

Fixing chats DataCache

This commit is contained in:
2018-02-17 16:25:50 +04:00
parent 2466a723be
commit 5e4ce71ff8
3 changed files with 5 additions and 2 deletions

View File

@@ -116,13 +116,14 @@ func (dc *DataCache) GetLeaguePrivateChats() []dbmapping.Chat {
// GetOrCreateChat returns current or new Chat object by Telegram update
func (dc *DataCache) GetOrCreateChat(update *tgbotapi.Update) (*dbmapping.Chat, error) {
telegramID := update.Message.From.ID
telegramID := update.Message.Chat.ID
chatRaw := dbmapping.Chat{}
c.Log.Info("DataCache: Getting chat with Telegram ID=", telegramID)
dc.chatsMutex.Lock()
for i := range dc.chats {
if dc.chats[i].TelegramID == int64(telegramID) {
c.Log.Debug("Chat stream found in DataCache")
dc.chatsMutex.Unlock()
return dc.chats[i], nil
}