Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/doobie.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,11 @@ func (p *Doobie) advance(b *bot.Bot, channelKey string, sequence *doobieSequence
return
}
line := doobieCountdownSteps[sequence.step]
sequence.timer = time.AfterFunc(p.delay, func() { p.advance(b, channelKey, sequence) })
p.mu.Unlock()

b.Send(sequence.target, line)
// Enqueue this step before the next timer can run, including zero delay.
p.schedule(b, channelKey, sequence)
}

func (p *Doobie) randomClosingLine() string {
Expand Down
1 change: 1 addition & 0 deletions plugins/doobie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func TestDoobieSequenceSendsFourSingleLineMessages(t *testing.T) {
b := bot.New(cfg, nil, nil, zap.NewNop())
// Replace the queue with a fast capture queue so the test does not depend on
// an IRC connection or the production pacing rate.
b.Queue.Drain(context.Background())
b.Queue = bot.NewQueue(1000, 20, func(message bot.Outgoing) { sent <- message.Text })
p := &Doobie{}
if err := p.Init(bot.PluginConfig{"countdown_delay_seconds": 0, "cooldown_seconds": 1}, nil); err != nil {
Expand Down
Loading