fix posts not being logged after logbot reconnect.
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-09 13:01:06 +02:00
parent 293102c1c6
commit c2d029f918
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -53,6 +53,8 @@ func (bot *Bot) Connect(server string, ssl bool, maxRetries int) (err error) {
} }
bot.ctx, bot.ctxCancel = context.WithCancel(bot.client.Context()) bot.ctx, bot.ctxCancel = context.WithCancel(bot.client.Context())
bot.channels = make(map[string]*Channel)
retries := 0 retries := 0
for maxRetries == 0 || retries < maxRetries { for maxRetries == 0 || retries < maxRetries {
err = bot.client.Connect(server, ssl) err = bot.client.Connect(server, ssl)
+2 -2
View File
@@ -29,7 +29,7 @@ type Channel struct {
} }
func newChannel(parent *Bot, name string, client *irc.Client) *Channel { func newChannel(parent *Bot, name string, client *irc.Client) *Channel {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(parent.ctx)
return &Channel{ return &Channel{
name: name, name: name,
@@ -266,7 +266,7 @@ func (channel *Channel) loop() {
channel.lastPostSessionID = "" channel.lastPostSessionID = ""
} }
case <-channel.parentCtx.Done(): case <-channel.ctx.Done():
{ {
// Time to pack up shop. // Time to pack up shop.
return return