@@ -879,27 +879,27 @@ function retryOperation<TMethod extends typeof Onyx.set | typeof Onyx.multiSet |
879879 const storageErrors = [ 'quotaexceedederror' , 'database or disk is full' , 'disk I/O error' , 'out of memory' ] ;
880880 const isStorageCapacityError = storageErrors . includes ( error ?. name ?. toLowerCase ( ) ) || storageErrors . some ( ( message ) => errorMessage ?. includes ( message ) ) ;
881881
882- if ( isStorageCapacityError ) {
883- // Find the first key that we can remove that has no subscribers in our blocklist
884- const keyForRemoval = cache . getKeyForEviction ( ) ;
885- if ( ! keyForRemoval ) {
886- // If we have no acceptable keys to remove then we are possibly trying to save mission critical data. If this is the case,
887- // then we should stop retrying as there is not much the user can do to fix this. Instead of getting them stuck in an infinite loop we
888- // will allow this write to be skipped.
889- Logger . logAlert ( 'Out of storage. But found no acceptable keys to remove.' ) ;
890- return reportStorageQuota ( ) ;
891- }
892-
893- // Remove the least recently viewed key that is not currently being accessed and retry.
894- Logger . logInfo ( `Out of storage. Evicting least recently accessed key (${ keyForRemoval } ) and retrying.` ) ;
895- reportStorageQuota ( ) ;
896-
882+ if ( ! isStorageCapacityError ) {
897883 // @ts -expect-error No overload matches this call.
898- return remove ( keyForRemoval ) . then ( ( ) => onyxMethod ( ...args ) ) ;
884+ return onyxMethod ( ...args ) ;
899885 }
900886
887+ // Find the first key that we can remove that has no subscribers in our blocklist
888+ const keyForRemoval = cache . getKeyForEviction ( ) ;
889+ if ( ! keyForRemoval ) {
890+ // If we have no acceptable keys to remove then we are possibly trying to save mission critical data. If this is the case,
891+ // then we should stop retrying as there is not much the user can do to fix this. Instead of getting them stuck in an infinite loop we
892+ // will allow this write to be skipped.
893+ Logger . logAlert ( 'Out of storage. But found no acceptable keys to remove.' ) ;
894+ return reportStorageQuota ( ) ;
895+ }
896+
897+ // Remove the least recently viewed key that is not currently being accessed and retry.
898+ Logger . logInfo ( `Out of storage. Evicting least recently accessed key (${ keyForRemoval } ) and retrying.` ) ;
899+ reportStorageQuota ( ) ;
900+
901901 // @ts -expect-error No overload matches this call.
902- return onyxMethod ( ...args ) ;
902+ return remove ( keyForRemoval ) . then ( ( ) => onyxMethod ( ...args ) ) ;
903903}
904904
905905/**
0 commit comments