Shell/mempool: bounded peer-workers request-queue size

This commit is contained in:
Raphaël Proust 2018-11-15 12:28:48 +08:00 committed by MBourgoin
parent 31242ebcb9
commit 7cbf457888
No known key found for this signature in database
GPG Key ID: 4B3F7008ABB5B2D0
2 changed files with 15 additions and 4 deletions

View File

@ -44,7 +44,12 @@ module type T = sig
end
module Make (Mempool_worker: Mempool_worker.T)
module type STATIC = sig
val max_pending_requests : int
end
module Make (Static: STATIC) (Mempool_worker: Mempool_worker.T)
: T with module Mempool_worker = Mempool_worker
= struct
@ -318,8 +323,10 @@ module Make (Mempool_worker: Mempool_worker.T)
end
module Worker = Worker.Make (Name) (Event) (Request) (Types)
type t = Worker.infinite Worker.queue Worker.t
let table = Worker.create_table Queue
type t = Worker.bounded Worker.queue Worker.t
let table =
let open Worker in
create_table (Bounded { size = Static.max_pending_requests })
(* 3. Workers' work: setting workers' callbacks to perform core work *)

View File

@ -63,5 +63,9 @@ module type T = sig
end
module Make (Mempool_worker : Mempool_worker.T)
module type STATIC = sig
val max_pending_requests : int
end
module Make (Static: STATIC) (Mempool_worker: Mempool_worker.T)
: T with module Mempool_worker = Mempool_worker