Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 5, 2013
1 parent cd04cd8 commit df75f0c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Mojo/IOLoop/Delay.pm
Expand Up @@ -43,17 +43,15 @@ sub _step {
# DEPRECATED in Rainbow!
else { push @{$self->{unordered}}, @_ }

return $self->{pending} if --$self->{pending} || $self->{step};
return $self->{pending} if --$self->{pending} || $self->{lock};
local $self->{lock} = 1;
my @args = (map {@$_} grep {defined} @{delete($self->{args}) || []});

# DEPRECATED in Rainbow!
push @args, @{delete($self->{unordered}) || []};

$self->{counter} = 0;
if (my $cb = shift @{$self->{steps} ||= []}) {
local $self->{step} = 1;
$self->$cb(@args);
}
if (my $cb = shift @{$self->{steps} ||= []}) { $self->$cb(@args) }

return 0 if $self->{pending};
if ($self->{counter}) { $self->ioloop->timer(0 => $self->begin) }
Expand Down

0 comments on commit df75f0c

Please sign in to comment.