Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update propagation stop request not working #1014

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading