Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/OnyxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ const IDB_STORAGE_ERRORS = [
// SQLite errors that indicate storage capacity issues where eviction can help
const SQLITE_STORAGE_ERRORS = [
'database or disk is full', // Device storage is full
'disk I/O error', // File system I/O failure, often due to insufficient space or corrupted storage
'out of memory', // Insufficient RAM or storage space to complete the operation
] as const;

const STORAGE_ERRORS = [...IDB_STORAGE_ERRORS, ...SQLITE_STORAGE_ERRORS];
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/onyxUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ describe('OnyxUtils', () => {
const retryOperationSpy = jest.spyOn(OnyxUtils, 'retryOperation');
const genericError = new Error('Generic storage error');
const invalidDataError = new Error("Failed to execute 'put' on 'IDBObjectStore': invalid data");
const memoryError = new Error('out of memory');
const diskFullError = new Error('database or disk is full');

it('should retry only one time if the operation is firstly failed and then passed', async () => {
StorageMock.setItem = jest.fn(StorageMock.setItem).mockRejectedValueOnce(genericError).mockImplementation(StorageMock.setItem);
Expand All @@ -387,7 +387,7 @@ describe('OnyxUtils', () => {
});

it('should not retry in case of storage capacity error and no keys to evict', async () => {
StorageMock.setItem = jest.fn().mockRejectedValue(memoryError);
StorageMock.setItem = jest.fn().mockRejectedValue(diskFullError);

await Onyx.set(ONYXKEYS.TEST_KEY, {test: 'data'});

Expand Down
Loading