prevent double joins accross workers, reduce log spam ab it
This commit is contained in:
parent
8046b1b39b
commit
a1e0da464e
2 changed files with 8 additions and 3 deletions
|
@ -108,7 +108,11 @@ func (b *Bot) Join(channelNames ...string) {
|
|||
// already joined but join again in case it was a temporary ban
|
||||
worker.client.Join(channel)
|
||||
joined = true
|
||||
} else if len(worker.joinedChannels) < 50 {
|
||||
}
|
||||
}
|
||||
|
||||
for _, worker := range b.worker {
|
||||
if len(worker.joinedChannels) < 50 {
|
||||
log.Info("[bot] joining " + channel)
|
||||
worker.client.Join(channel)
|
||||
worker.joinedChannels[channel] = true
|
||||
|
@ -116,6 +120,7 @@ func (b *Bot) Join(channelNames ...string) {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !joined {
|
||||
client := b.newClient()
|
||||
go client.Connect()
|
||||
|
|
|
@ -140,7 +140,7 @@ func (c *Client) GetUsersByUserIds(userIDs []string) (map[string]UserData, error
|
|||
for _, id := range userIDs {
|
||||
value, ok := userCacheByID.Load(id)
|
||||
if !ok {
|
||||
log.Warningf("Could not find userId, channel might be banned: %s", id)
|
||||
log.Debugf("Could not find userId, channel might be banned: %s", id)
|
||||
continue
|
||||
}
|
||||
result[id] = *(value.(*UserData))
|
||||
|
@ -198,7 +198,7 @@ func (c *Client) GetUsersByUsernames(usernames []string) (map[string]UserData, e
|
|||
username = strings.ToLower(username)
|
||||
value, ok := userCacheByUsername.Load(username)
|
||||
if !ok {
|
||||
log.Warningf("Could not find username, channel might be banned: %s", username)
|
||||
log.Debugf("Could not find username, channel might be banned: %s", username)
|
||||
continue
|
||||
}
|
||||
result[username] = *(value.(*UserData))
|
||||
|
|
Loading…
Reference in a new issue