Skip to content

Commit

Permalink
Merge pull request #572 from ugexe/close-supplies
Browse files Browse the repository at this point in the history
Optimize use of Supply
  • Loading branch information
ugexe authored Oct 12, 2024
2 parents 0e4e9de + 72e29a0 commit 51f34a8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/Zef/Repository.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,18 @@ class Zef::Repository does PackageRepository does Pluggable {
$plugin.can('update');
}

@can-update.race(:batch(1)).map({
my $stdout = Supplier.new;
my $stderr = Supplier.new;
if ?$logger {
$stdout.Supply.act: -> $out { $logger.emit({ level => VERBOSE, stage => RESOLVE, phase => LIVE, message => $out }) }
$stderr.Supply.act: -> $err { $logger.emit({ level => ERROR, stage => RESOLVE, phase => LIVE, message => $err }) }
}
my $stdout = Supplier.new;
my $stderr = Supplier.new;
if ?$logger {
$stdout.Supply.act: -> $out { $logger.emit({ level => VERBOSE, stage => RESOLVE, phase => LIVE, message => $out }) }
$stderr.Supply.act: -> $err { $logger.emit({ level => ERROR, stage => RESOLVE, phase => LIVE, message => $err }) }
}

@can-update.race(:batch(1)).map({
$_.update(:$stdout, :$stderr);

$stderr.done()
});

$stdout.done();
$stderr.done();
}
}

0 comments on commit 51f34a8

Please sign in to comment.