Skip to content

Commit

Permalink
Fix update propagation stop request not working
Browse files Browse the repository at this point in the history
  • Loading branch information
tleedjarv committed Mar 31, 2024
1 parent 2239955 commit 94f939f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/transport.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ let maxThreads () =

let run dispenseTask =
let runConcurrent limit dispenseTask =
let dispenseTask () = if Abort.isAll () then None else dispenseTask () in
let avail = ref limit in
let rec runTask thr =
Lwt.try_bind thr
Expand Down
10 changes: 8 additions & 2 deletions src/uicommon.ml
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,15 @@ let transportStart () = Transport.logStart ()
let transportFinish () = Transport.logFinish ()

let transportItems items pRiThisRound makeAction =
if Abort.isAll () then () else
let waiter = Lwt.wait () in
let outstanding = ref 0 in
let starting () = incr outstanding in
let completed () =
decr outstanding;
if !outstanding = 0 then begin
if !outstanding = 0 || (!outstanding = 1 && Abort.isAll ()) then begin
(* If there is a stop request then we might not get the [completed]
notice for the dispense loop itself, so we also stop at count 1. *)
try Lwt.wakeup waiter () with Invalid_argument _ -> ()
end
in
Expand Down Expand Up @@ -682,7 +685,10 @@ let transportItems items pRiThisRound makeAction =
in
let rec dispenseAction () =
let i = !idx in
if i < im then begin
if Abort.isAll () then begin
stopDispense ();
dispenseDone ()
end else if i < im then begin
let item = items.(i) in
incr idx;
if pRiThisRound item then
Expand Down

0 comments on commit 94f939f

Please sign in to comment.