mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 13:39:44 +02:00
fix(core): Retry each file removal in the byte store's delete (#39193)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
3a31c38751
commit
7bebbe4033
|
|
@ -125,6 +125,18 @@ describe('delete', () => {
|
|||
it('does not throw on deleting a missing key', async () => {
|
||||
await expect(store.delete(['a/missing.json'])).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('passes a retry budget to each file removal', async () => {
|
||||
await store.write('a/one.json', body);
|
||||
const rmSpy = vi.spyOn(fs, 'rm');
|
||||
|
||||
await store.delete(['a/one.json']);
|
||||
|
||||
expect(rmSpy).toHaveBeenCalledWith(join(storagePath, 'a/one.json'), {
|
||||
force: true,
|
||||
maxRetries: 3,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('write (stream)', () => {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ export class FsByteStore implements ByteStore {
|
|||
|
||||
async delete(keys: ByteStoreKey[]) {
|
||||
const deletePaths = keys.map((key) => this.getAbsolutePath(key));
|
||||
await Promise.all(deletePaths.map(async (p) => await fs.rm(p, { force: true })));
|
||||
await Promise.all(deletePaths.map(async (p) => await fs.rm(p, { force: true, maxRetries: 3 })));
|
||||
const dirs = [...new Set(deletePaths.map((p) => path.dirname(p)))];
|
||||
await Promise.all(dirs.map(async (dir) => await this.removeEmptyAncestors(dir)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user