Shell: Avoid leak in distributed_db_functor worker loop
This commit is contained in:
parent
8b8dcddd02
commit
3da1e56133
@ -466,9 +466,10 @@ end = struct
|
|||||||
(* TODO *)
|
(* TODO *)
|
||||||
Lwt.return_unit
|
Lwt.return_unit
|
||||||
|
|
||||||
let rec worker_loop state =
|
let worker_loop state =
|
||||||
let shutdown = Lwt_canceler.cancelation state.canceler
|
let shutdown = Lwt_canceler.cancelation state.canceler in
|
||||||
and timeout = compute_timeout state in
|
let rec loop state =
|
||||||
|
let timeout = compute_timeout state in
|
||||||
Lwt.choose
|
Lwt.choose
|
||||||
[ (state.events >|= fun _ -> ()) ; timeout ; shutdown ] >>= fun () ->
|
[ (state.events >|= fun _ -> ()) ; timeout ; shutdown ] >>= fun () ->
|
||||||
if Lwt.state shutdown <> Lwt.Sleep then
|
if Lwt.state shutdown <> Lwt.Sleep then
|
||||||
@ -479,7 +480,7 @@ end = struct
|
|||||||
state.events >>= fun events ->
|
state.events >>= fun events ->
|
||||||
state.events <- Lwt_pipe.pop_all state.queue ;
|
state.events <- Lwt_pipe.pop_all state.queue ;
|
||||||
Lwt_list.iter_s (process_event state now) events >>= fun () ->
|
Lwt_list.iter_s (process_event state now) events >>= fun () ->
|
||||||
worker_loop state
|
loop state
|
||||||
else
|
else
|
||||||
lwt_debug "timeout" >>= fun () ->
|
lwt_debug "timeout" >>= fun () ->
|
||||||
let now = Unix.gettimeofday () in
|
let now = Unix.gettimeofday () in
|
||||||
@ -518,7 +519,9 @@ end = struct
|
|||||||
Hash.pp key P2p_peer.Id.pp_short peer)
|
Hash.pp key P2p_peer.Id.pp_short peer)
|
||||||
request
|
request
|
||||||
end requests Lwt.return_unit >>= fun () ->
|
end requests Lwt.return_unit >>= fun () ->
|
||||||
worker_loop state
|
loop state
|
||||||
|
in
|
||||||
|
loop state
|
||||||
|
|
||||||
let create param =
|
let create param =
|
||||||
let state = {
|
let state = {
|
||||||
|
Loading…
Reference in New Issue
Block a user