3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 10:59:29 +01:00

Timer: minor visual style change

This commit is contained in:
Pragmatic Software 2020-03-08 19:11:52 -07:00
parent 340e31acb2
commit 2bd034c951

View File

@ -184,14 +184,14 @@ sub enqueue_event {
my $i = $self->find_enqueue_position($event->{timeout}); my $i = $self->find_enqueue_position($event->{timeout});
splice @{$self->{event_queue}}, $i, 0, $event; splice @{$self->{event_queue}}, $i, 0, $event;
if ($interval < $waitfor) {
$self->waitfor($interval);
}
my $debug = $self->{pbot}->{registry}->get_value('timer', 'debug') // 0; my $debug = $self->{pbot}->{registry}->get_value('timer', 'debug') // 0;
if ($debug > 1) { if ($debug > 1) {
$self->{pbot}->{logger}->log("Enqueued new timer event $id at position $i: timeout=$event->{timeout} interval=$interval repeating=$repeating\n"); $self->{pbot}->{logger}->log("Enqueued new timer event $id at position $i: timeout=$event->{timeout} interval=$interval repeating=$repeating\n");
} }
if ($interval < $waitfor) {
$self->waitfor($interval);
}
} }
sub dequeue_event { sub dequeue_event {
@ -290,11 +290,11 @@ sub on_tick_handler {
} }
} }
$self->waitfor($next_tick);
foreach my $event (@enqueue) { foreach my $event (@enqueue) {
$self->enqueue_event($event->{subref}, $event->{interval}, $event->{id}, 1); $self->enqueue_event($event->{subref}, $event->{interval}, $event->{id}, 1);
} }
$self->waitfor($next_tick);
} else { } else {
# no queued events, call default overridable on_tick() method if timeout has elapsed # no queued events, call default overridable on_tick() method if timeout has elapsed
if ($seconds - $self->{last} >= $self->{timeout}) { if ($seconds - $self->{last} >= $self->{timeout}) {