feat(core): Introduce object store service (#7225)
Depends on https://github.com/n8n-io/n8n/pull/7220 | Story: [PAY-840](https://linear.app/n8n/issue/PAY-840/introduce-object-store-service-and-manager-for-binary-data) This PR introduces an object store service for Enterprise edition. Note that the service is tested but currently unused - it will be integrated soon as a binary data manager, and later for execution data. `amazonaws.com` in the host is temporarily hardcoded until we integrate the service and test against AWS, Cloudflare and Backblaze, in the next PR. This is ready for review - the PR it depends on is approved and waiting for CI. --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -505,9 +505,9 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
||||
const date = new Date();
|
||||
date.setHours(date.getHours() - 1);
|
||||
|
||||
const executionIds = (
|
||||
const workflowIdsAndExecutionIds = (
|
||||
await this.find({
|
||||
select: ['id'],
|
||||
select: ['workflowId', 'id'],
|
||||
where: {
|
||||
deletedAt: LessThanOrEqual(DateUtils.mixedDateToUtcDatetimeString(date)),
|
||||
},
|
||||
@@ -519,14 +519,16 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
||||
*/
|
||||
withDeleted: true,
|
||||
})
|
||||
).map(({ id }) => id);
|
||||
).map(({ id: executionId, workflowId }) => ({ workflowId, executionId }));
|
||||
|
||||
const executionIds = workflowIdsAndExecutionIds.map((o) => o.executionId);
|
||||
|
||||
if (executionIds.length === 0) {
|
||||
this.logger.debug('Found no executions to hard-delete from database');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.binaryDataService.deleteManyByExecutionIds(executionIds);
|
||||
await this.binaryDataService.deleteMany(workflowIdsAndExecutionIds);
|
||||
|
||||
this.logger.debug(`Hard-deleting ${executionIds.length} executions from database`, {
|
||||
executionIds,
|
||||
|
||||
Reference in New Issue
Block a user