File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -887,14 +887,19 @@ function retryOperation<TMethod extends RetriableOnyxOperation>(
887887 return reportStorageQuota ( error ) ;
888888 }
889889
890- // Remove the least recently accessed key and retry. Tell the breaker we evicted so that, if the
891- // retry comes back as another capacity failure, it counts as a no-progress cycle.
890+ // Remove the least recently accessed key and retry.
892891 Logger . logInfo ( `Out of storage. Evicting least recently accessed key (${ keyForRemoval } ) and retrying. Error: ${ error } ` ) ;
893892 reportStorageQuota ( error ) ;
894- StorageCircuitBreaker . recordEviction ( ) ;
895893
896894 // @ts -expect-error No overload matches this call.
897- return remove ( keyForRemoval ) . then ( ( ) => onyxMethod ( defaultParams , nextRetryAttempt ) ) ;
895+ return remove ( keyForRemoval ) . then ( ( ) => {
896+ // Mark the eviction only once the deletion has actually completed, immediately before the
897+ // retry it pairs with. Recording earlier lets a concurrent write's capacity failure consume
898+ // the marker as a no-progress cycle while this deletion is still pending and may yet free
899+ // space — so the verdict belongs to the retry that follows the deletion, not the eviction call.
900+ StorageCircuitBreaker . recordEviction ( ) ;
901+ return onyxMethod ( defaultParams , nextRetryAttempt ) ;
902+ } ) ;
898903}
899904
900905/**
You can’t perform that action at this time.
0 commit comments