From 04573da150d0afd9a949462d9b633f8f1d0490df Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Fri, 24 May 2024 00:34:55 +0200 Subject: [PATCH] Prevent divide-by-zero Which apparently can happen on Windows CI ???? --- lib/ParaSeq.rakumod | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ParaSeq.rakumod b/lib/ParaSeq.rakumod index c91acb8..bdde348 100644 --- a/lib/ParaSeq.rakumod +++ b/lib/ParaSeq.rakumod @@ -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