Skip to content

Commit

Permalink
Prevent divide-by-zero
Browse files Browse the repository at this point in the history
Which apparently can happen on Windows CI ????
  • Loading branch information
lizmat committed May 23, 2024
1 parent b68eceb commit 04573da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/ParaSeq.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ my class ParaIterator does Iterator {
$!produced = $produced;
$!nsecs = $nsecs;

nqp::push( # initiate more work with updated batch size
$!pressure,
$!batch = nqp::div_i(nqp::mul_i($processed,$target-nsecs),$nsecs)
);
# Update batch size
$!batch = nqp::div_i(nqp::mul_i($processed,$target-nsecs),$nsecs)
if $nsecs;

# Initiate more work with updated batch size
nqp::push($!pressure,$!batch);
}

# Next buffer to be processed
Expand Down

0 comments on commit 04573da

Please sign in to comment.