mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
fix(core): Delete binary data parent folder when pruning executions (#11790)
This commit is contained in:
committed by
GitHub
parent
91f9390b90
commit
17ef2c63f6
@@ -93,7 +93,7 @@ export class FileSystemManager implements BinaryData.Manager {
|
|||||||
// binary files stored in nested dirs - `filesystem-v2`
|
// binary files stored in nested dirs - `filesystem-v2`
|
||||||
|
|
||||||
const binaryDataDirs = ids.map(({ workflowId, executionId }) =>
|
const binaryDataDirs = ids.map(({ workflowId, executionId }) =>
|
||||||
this.resolvePath(`workflows/${workflowId}/executions/${executionId}/binary_data/`),
|
this.resolvePath(`workflows/${workflowId}/executions/${executionId}`),
|
||||||
);
|
);
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ describe('copyByFilePath()', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('deleteMany()', () => {
|
describe('deleteMany()', () => {
|
||||||
|
const rmOptions = {
|
||||||
|
force: true,
|
||||||
|
recursive: true,
|
||||||
|
};
|
||||||
|
|
||||||
it('should delete many files by workflow ID and execution ID', async () => {
|
it('should delete many files by workflow ID and execution ID', async () => {
|
||||||
const ids = [
|
const ids = [
|
||||||
{ workflowId, executionId },
|
{ workflowId, executionId },
|
||||||
@@ -160,6 +165,16 @@ describe('deleteMany()', () => {
|
|||||||
await expect(promise).resolves.not.toThrow();
|
await expect(promise).resolves.not.toThrow();
|
||||||
|
|
||||||
expect(fsp.rm).toHaveBeenCalledTimes(2);
|
expect(fsp.rm).toHaveBeenCalledTimes(2);
|
||||||
|
expect(fsp.rm).toHaveBeenNthCalledWith(
|
||||||
|
1,
|
||||||
|
`${storagePath}/workflows/${workflowId}/executions/${executionId}`,
|
||||||
|
rmOptions,
|
||||||
|
);
|
||||||
|
expect(fsp.rm).toHaveBeenNthCalledWith(
|
||||||
|
2,
|
||||||
|
`${storagePath}/workflows/${otherWorkflowId}/executions/${otherExecutionId}`,
|
||||||
|
rmOptions,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should suppress error on non-existing filepath', async () => {
|
it('should suppress error on non-existing filepath', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user