-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disallow multiple build commands
Running dune concurrently is no longer allowed because we create the rpc socket file eagerly and treat it as a lock Signed-off-by: Rudi Grinberg <[email protected]> ps-id: 491f09b0-a316-43b8-8df5-a05f53fa331a
- Loading branch information
Showing
27 changed files
with
510 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
open Fiber.O | ||
|
||
type server = | ||
{ run : unit Fiber.t | ||
; stop : unit Fiber.t | ||
; ready : unit Fiber.t | ||
} | ||
|
||
type t = | ||
{ server : server | ||
; pool : Fiber.Pool.t | ||
} | ||
|
||
let t = Fiber.Var.create () | ||
|
||
let with_background_rpc server f = | ||
let pool = Fiber.Pool.create () in | ||
Fiber.Var.set t { server; pool } (fun () -> | ||
Fiber.fork_and_join_unit | ||
(fun () -> Fiber.Pool.run pool) | ||
(fun () -> Fiber.finalize f ~finally:(fun () -> Fiber.Pool.stop pool))) | ||
|
||
let ensure_ready () = | ||
let* { server; pool } = Fiber.Var.get_exn t in | ||
let* () = Fiber.Pool.task pool ~f:(fun () -> server.run) in | ||
server.ready | ||
|
||
let stop () = | ||
let* { server; pool } = Fiber.Var.get_exn t in | ||
Fiber.fork_and_join_unit | ||
(fun () -> Fiber.Pool.stop pool) | ||
(fun () -> server.stop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type server = | ||
{ run : unit Fiber.t | ||
; stop : unit Fiber.t | ||
; ready : unit Fiber.t | ||
} | ||
|
||
val with_background_rpc : server -> (unit -> 'a Fiber.t) -> 'a Fiber.t | ||
|
||
val ensure_ready : unit -> unit Fiber.t | ||
|
||
val stop : unit -> unit Fiber.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.