3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

simplify read of lastSeen

This commit is contained in:
Shivaram Lingamneni 2020-03-02 02:52:51 -05:00
parent e7c1800893
commit d72037725b

View File

@ -1624,6 +1624,7 @@ func (client *Client) performWrite() {
dirtyBits := client.dirtyBits dirtyBits := client.dirtyBits
client.dirtyBits = 0 client.dirtyBits = 0
account := client.account account := client.account
lastSeen := client.lastSeen
client.stateMutex.Unlock() client.stateMutex.Unlock()
if account == "" { if account == "" {
@ -1640,9 +1641,6 @@ func (client *Client) performWrite() {
client.server.accounts.saveChannels(account, channelNames) client.server.accounts.saveChannels(account, channelNames)
} }
if (dirtyBits & IncludeLastSeen) != 0 { if (dirtyBits & IncludeLastSeen) != 0 {
client.stateMutex.RLock()
lastSeen := client.lastSeen
client.stateMutex.RUnlock()
client.server.accounts.saveLastSeen(account, lastSeen) client.server.accounts.saveLastSeen(account, lastSeen)
} }
} }