From f096136c379183766807e9da03967a81fe1b9f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Wed, 30 Jun 2021 11:21:36 +0200 Subject: [PATCH] :zap: Reformat pruning date to UTC string --- packages/cli/src/WorkflowExecuteAdditionalData.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/WorkflowExecuteAdditionalData.ts b/packages/cli/src/WorkflowExecuteAdditionalData.ts index a969dbc812..efaabd33f8 100644 --- a/packages/cli/src/WorkflowExecuteAdditionalData.ts +++ b/packages/cli/src/WorkflowExecuteAdditionalData.ts @@ -46,6 +46,7 @@ import { import * as config from '../config'; import { LessThanOrEqual } from 'typeorm'; +import { DateUtils } from 'typeorm/util/DateUtils'; const ERROR_TRIGGER_TYPE = config.get('nodes.errorTriggerType') as string; @@ -112,8 +113,11 @@ function pruneExecutionData(this: WorkflowHooks): void { const date = new Date(); // today date.setHours(date.getHours() - maxAge); + // date reformatting needed - see https://github.com/typeorm/typeorm/issues/2286 + const utcDate = DateUtils.mixedDateToUtcDatetimeString(date); + // throttle just on success to allow for self healing on failure - Db.collections.Execution!.delete({ stoppedAt: LessThanOrEqual(date.toISOString()) }) + Db.collections.Execution!.delete({ stoppedAt: LessThanOrEqual(utcDate) }) .then(data => setTimeout(() => { throttling = false;