@@ -58,6 +58,7 @@ use graphql_ir::FragmentDefinitionNameSet;
5858use graphql_ir:: Program ;
5959use indexmap:: IndexSet ;
6060use log:: debug;
61+ use log:: error;
6162use log:: info;
6263use log:: warn;
6364use petgraph:: unionfind:: UnionFind ;
@@ -595,6 +596,19 @@ pub async fn commit_project(
595596 return Err ( BuildProjectFailure :: Cancelled ) ;
596597 }
597598
599+ // Start hash map prefetch as a background task. The closure extracts
600+ // artifact paths synchronously, then the spawned future does the async
601+ // Eden Thrift RPC (~5-10s). This overlaps the network I/O with
602+ // persist_operations and generate_extra_artifacts below.
603+ let hash_map_handle = if !artifacts. is_empty ( ) {
604+ config
605+ . get_artifacts_file_hash_map
606+ . as_ref ( )
607+ . map ( |get_fn| tokio:: spawn ( get_fn ( & artifacts) ) )
608+ } else {
609+ None
610+ } ;
611+
598612 if let Some ( operation_persister) = config
599613 . create_operation_persister
600614 . as_ref ( )
@@ -649,19 +663,21 @@ pub async fn commit_project(
649663 }
650664 } ;
651665
652- let artifacts_file_hash_map = if artifacts. is_empty ( ) {
653- None
654- } else {
655- match & config. get_artifacts_file_hash_map {
656- Some ( get_fn) => {
657- let get_artifacts_file_hash_map_timer =
658- log_event. start ( "get_artifacts_file_hash_map_time" ) ;
659- let res = get_fn ( & artifacts) . await ;
660- log_event. stop ( get_artifacts_file_hash_map_timer) ;
661- res
662- }
663- _ => None ,
666+ // Await the prefetched hash map. The timer measures only the remaining
667+ // wait time — if the Eden RPC completed during persist/generate above,
668+ // this resolves immediately (~0ms).
669+ let artifacts_file_hash_map = match hash_map_handle {
670+ Some ( handle) => {
671+ let get_artifacts_file_hash_map_timer =
672+ log_event. start ( "get_artifacts_file_hash_map_time" ) ;
673+ let res = handle. await . unwrap_or_else ( |e| {
674+ error ! ( "hash map prefetch failed: {e}" ) ;
675+ None
676+ } ) ;
677+ log_event. stop ( get_artifacts_file_hash_map_timer) ;
678+ res
664679 }
680+ None => None ,
665681 } ;
666682
667683 // Write the generated artifacts to disk. This step is separate from
0 commit comments