@@ -120,30 +120,19 @@ impl VersionedContentMap {
120
120
client_relative_path : Vc < FileSystemPath > ,
121
121
client_output_path : Vc < FileSystemPath > ,
122
122
) -> 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 ( ) ;
139
128
140
129
self . map_path_to_op . update_conditionally ( |map| {
141
130
let mut changed = false ;
142
131
143
132
// get current map's keys, subtract keys that don't exist in operation
144
133
let mut stale_assets = map. 0 . keys ( ) . copied ( ) . collect :: < FxHashSet < _ > > ( ) ;
145
134
146
- for ( k, _) in entries. iter ( ) {
135
+ for ( k, _) in entries. iter ( ) . flatten ( ) {
147
136
let res = map. 0 . entry ( * k) . or_default ( ) . insert ( assets_operation) ;
148
137
stale_assets. remove ( k) ;
149
138
changed = changed || res;
@@ -163,12 +152,17 @@ impl VersionedContentMap {
163
152
} ) ;
164
153
165
154
// 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 ?;
169
163
let map_entry = Vc :: cell ( Some ( MapEntry {
170
164
assets_operation,
171
- path_to_asset : entries. into_iter ( ) . collect ( ) ,
165
+ path_to_asset : entries. iter ( ) . flatten ( ) . copied ( ) . collect ( ) ,
172
166
} ) ) ;
173
167
Ok ( map_entry)
174
168
}
@@ -265,6 +259,25 @@ impl VersionedContentMap {
265
259
}
266
260
}
267
261
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
+
268
281
#[ turbo_tasks:: function( operation) ]
269
282
fn compute_entry_operation (
270
283
map : ResolvedVc < VersionedContentMap > ,
0 commit comments