Skip to content

Commit

Permalink
refactor: make stanza loading lazier (#8745)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Sep 23, 2023
1 parent 51183c0 commit 165f3d6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/dune_rules/artifacts_db.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,17 @@ let all =
let+ contexts = Context.DB.all () in
Context_name.Map.of_list_map_exn contexts ~f:(fun context ->
let artifacts =
Memo.lazy_
@@ fun () ->
let+ stanzas = Only_packages.filtered_stanzas context in
let local_bins =
Memo.lazy_ ~name:"get_installed_binaries" (fun () ->
let* stanzas = Only_packages.filtered_stanzas context in
get_installed_binaries ~context stanzas)
in
Artifacts.create context ~local_bins
Artifacts.create context ~local_bins |> Memo.return
in
Context.name context, artifacts)
;;

let get (context : Context.t) =
let* all = Memo.Lazy.force all in
Context_name.Map.find_exn all (Context.name context) |> Memo.Lazy.force
Context_name.Map.find_exn all (Context.name context)
;;

0 comments on commit 165f3d6

Please sign in to comment.