@@ -120,30 +120,19 @@ impl VersionedContentMap {
120120 client_relative_path : Vc < FileSystemPath > ,
121121 client_output_path : Vc < FileSystemPath > ,
122122 ) -> Result < Vc < OptionMapEntry > > {
123- let assets = assets_operation. connect ( ) ;
124- async fn get_entries (
125- assets : Vc < OutputAssets > ,
126- ) -> Result < Vec < ( ResolvedVc < FileSystemPath > , ResolvedVc < Box < dyn OutputAsset > > ) > > {
127- let assets_ref = assets. await ?;
128- let entries = assets_ref
129- . iter ( )
130- . map ( |& asset| async move {
131- let path = asset. path ( ) . to_resolved ( ) . await ?;
132- Ok ( ( path, asset) )
133- } )
134- . try_join ( )
135- . await ?;
136- Ok ( entries)
137- }
138- let entries = get_entries ( assets) . await . unwrap_or_default ( ) ;
123+ let entries = get_entries ( assets_operation)
124+ . read_strongly_consistent ( )
125+ . await
126+ // Any error should result in an empty list, which removes all assets from the map
127+ . ok ( ) ;
139128
140129 self . map_path_to_op . update_conditionally ( |map| {
141130 let mut changed = false ;
142131
143132 // get current map's keys, subtract keys that don't exist in operation
144133 let mut stale_assets = map. 0 . keys ( ) . copied ( ) . collect :: < FxHashSet < _ > > ( ) ;
145134
146- for ( k, _) in entries. iter ( ) {
135+ for ( k, _) in entries. iter ( ) . flatten ( ) {
147136 let res = map. 0 . entry ( * k) . or_default ( ) . insert ( assets_operation) ;
148137 stale_assets. remove ( k) ;
149138 changed = changed || res;
@@ -163,12 +152,17 @@ impl VersionedContentMap {
163152 } ) ;
164153
165154 // Make sure all written client assets are up-to-date
166- let _ = emit_assets ( assets, node_root, client_relative_path, client_output_path)
167- . resolve ( )
168- . await ?;
155+ let _ = emit_assets (
156+ assets_operation. connect ( ) ,
157+ node_root,
158+ client_relative_path,
159+ client_output_path,
160+ )
161+ . resolve ( )
162+ . await ?;
169163 let map_entry = Vc :: cell ( Some ( MapEntry {
170164 assets_operation,
171- path_to_asset : entries. into_iter ( ) . collect ( ) ,
165+ path_to_asset : entries. iter ( ) . flatten ( ) . copied ( ) . collect ( ) ,
172166 } ) ) ;
173167 Ok ( map_entry)
174168 }
@@ -265,6 +259,25 @@ impl VersionedContentMap {
265259 }
266260}
267261
262+ type GetEntriesResultT = Vec < ( ResolvedVc < FileSystemPath > , ResolvedVc < Box < dyn OutputAsset > > ) > ;
263+
264+ #[ turbo_tasks:: value( transparent) ]
265+ struct GetEntriesResult ( GetEntriesResultT ) ;
266+
267+ #[ turbo_tasks:: function( operation) ]
268+ async fn get_entries ( assets : OperationVc < OutputAssets > ) -> Result < Vc < GetEntriesResult > > {
269+ let assets_ref = assets. connect ( ) . await ?;
270+ let entries = assets_ref
271+ . iter ( )
272+ . map ( |& asset| async move {
273+ let path = asset. path ( ) . to_resolved ( ) . await ?;
274+ Ok ( ( path, asset) )
275+ } )
276+ . try_join ( )
277+ . await ?;
278+ Ok ( Vc :: cell ( entries) )
279+ }
280+
268281#[ turbo_tasks:: function( operation) ]
269282fn compute_entry_operation (
270283 map : ResolvedVc < VersionedContentMap > ,
0 commit comments