mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
Timer: minor visual style change
This commit is contained in:
parent
340e31acb2
commit
2bd034c951
@ -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}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user