3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 13:29:27 +01:00

don't write to mysql while holding joinPartMutex

This commit is contained in:
Shivaram Lingamneni 2020-02-20 02:57:39 -05:00
parent 4472683d58
commit 282e7a4d57

View File

@ -682,8 +682,6 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
client.server.logger.Debug("join", fmt.Sprintf("%s joined channel %s", details.nick, chname))
var message utils.SplitMessage
givenMode := func() (givenMode modes.Mode) {
channel.joinPartMutex.Lock()
defer channel.joinPartMutex.Unlock()
@ -707,22 +705,23 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
channel.regenerateMembersCache()
// no history item for fake persistent joins
if rb != nil {
message = utils.MakeMessage("")
histItem := history.Item{
Type: history.Join,
Nick: details.nickMask,
AccountName: details.accountName,
Message: message,
}
histItem.Params[0] = details.realname
channel.AddHistoryItem(histItem)
}
return
}()
var message utils.SplitMessage
// no history item for fake persistent joins
if rb != nil {
message = utils.MakeMessage("")
histItem := history.Item{
Type: history.Join,
Nick: details.nickMask,
AccountName: details.accountName,
Message: message,
}
histItem.Params[0] = details.realname
channel.AddHistoryItem(histItem)
}
client.addChannel(channel)
var modestr string