@@ -1267,7 +1267,6 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
12671267 return task_id;
12681268 }
12691269
1270- self . track_cache_miss ( & task_type) ;
12711270 let tx = self
12721271 . should_restore ( )
12731272 . then ( || self . backing_storage . start_read_transaction ( ) )
@@ -1279,6 +1278,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
12791278 . forward_lookup_task_cache ( tx. as_ref ( ) , & task_type)
12801279 . expect ( "Failed to lookup task id" )
12811280 } {
1281+ self . track_cache_hit ( & task_type) ;
12821282 let _ = self . task_cache . try_insert ( Arc :: new ( task_type) , task_id) ;
12831283 task_id
12841284 } else {
@@ -1287,12 +1287,14 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
12871287 let task_id = if let Err ( existing_task_id) =
12881288 self . task_cache . try_insert ( task_type. clone ( ) , task_id)
12891289 {
1290+ self . track_cache_hit ( & task_type) ;
12901291 // Safety: We just created the id and failed to insert it.
12911292 unsafe {
12921293 self . persisted_task_id_factory . reuse ( task_id) ;
12931294 }
12941295 existing_task_id
12951296 } else {
1297+ self . track_cache_miss ( & task_type) ;
12961298 task_id
12971299 } ;
12981300 if let Some ( log) = & self . persisted_task_cache_log {
@@ -1327,10 +1329,10 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
13271329 return task_id;
13281330 }
13291331
1330- self . track_cache_miss ( & task_type) ;
13311332 let task_type = Arc :: new ( task_type) ;
13321333 let task_id = self . transient_task_id_factory . get ( ) ;
1333- if let Err ( existing_task_id) = self . task_cache . try_insert ( task_type, task_id) {
1334+ if let Err ( existing_task_id) = self . task_cache . try_insert ( task_type. clone ( ) , task_id) {
1335+ self . track_cache_hit ( & task_type) ;
13341336 // Safety: We just created the id and failed to insert it.
13351337 unsafe {
13361338 self . transient_task_id_factory . reuse ( task_id) ;
@@ -1339,6 +1341,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
13391341 return existing_task_id;
13401342 }
13411343
1344+ self . track_cache_miss ( & task_type) ;
13421345 self . connect_child ( parent_task, task_id, turbo_tasks) ;
13431346
13441347 task_id
0 commit comments