Browse Source

fix posts not being logged after logbot reconnect.

master 1.0.7
Gisle Aune 4 years ago
parent
commit
c2d029f918
  1. 2
      internal/bot/bot.go
  2. 4
      internal/bot/channel.go

2
internal/bot/bot.go

@ -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.channels = make(map[string]*Channel)
retries := 0
for maxRetries == 0 || retries < maxRetries {
err = bot.client.Connect(server, ssl)

4
internal/bot/channel.go

@ -29,7 +29,7 @@ type Channel struct {
}
func newChannel(parent *Bot, name string, client *irc.Client) *Channel {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(parent.ctx)
return &Channel{
name: name,
@ -266,7 +266,7 @@ func (channel *Channel) loop() {
channel.lastPostSessionID = ""
}
case <-channel.parentCtx.Done():
case <-channel.ctx.Done():
{
// Time to pack up shop.
return

Loading…
Cancel
Save