Adding lock to recurring.

This commit is contained in:
Sergiotarxz 2024-05-24 08:38:59 +02:00
parent e885958ea0
commit 8426dc6dfb
1 changed files with 7 additions and 1 deletions

View File

@ -39,9 +39,14 @@ sub run ($self) {
}
sub _dispatch_updates ($self) {
my $in_process = 0;
Mojo::IOLoop->recurring(
0.5,
0.1,
sub {
if ($in_process) {
return;
}
$in_process = 1;
if ( $self->_used_cores >= $self->_cores ) {
return;
}
@ -96,6 +101,7 @@ sub _dispatch_updates ($self) {
);
say $i;
}
$in_process = 0;
}
);
}