mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
remove redundant database write on always-on recreation
This commit is contained in:
parent
b4f720ae04
commit
a74450d6ca
@ -720,7 +720,7 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
|
||||
channel.AddHistoryItem(histItem)
|
||||
}
|
||||
|
||||
client.addChannel(channel)
|
||||
client.addChannel(channel, rb == nil)
|
||||
|
||||
if rb == nil {
|
||||
return
|
||||
|
@ -1496,13 +1496,15 @@ func (session *Session) Notice(text string) {
|
||||
session.Send(nil, session.client.server.name, "NOTICE", session.client.Nick(), text)
|
||||
}
|
||||
|
||||
func (client *Client) addChannel(channel *Channel) {
|
||||
// `simulated` is for the fake join of an always-on client
|
||||
// (we just read the channel name from the database, there's no need to write it back)
|
||||
func (client *Client) addChannel(channel *Channel, simulated bool) {
|
||||
client.stateMutex.Lock()
|
||||
client.channels[channel] = true
|
||||
alwaysOn := client.alwaysOn
|
||||
client.stateMutex.Unlock()
|
||||
|
||||
if alwaysOn {
|
||||
if alwaysOn && !simulated {
|
||||
client.markDirty(IncludeChannels)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user