remove redundant database write on always-on recreation

This commit is contained in:
Shivaram Lingamneni 2020-03-02 01:22:00 -05:00
parent b4f720ae04
commit a74450d6ca
2 changed files with 5 additions and 3 deletions

View file

@ -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)
}
}