mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
⚡ Reformat pruning date to UTC string
This commit is contained in:
parent
65e6d7c0f8
commit
f096136c37
|
@ -46,6 +46,7 @@ import {
|
||||||
import * as config from '../config';
|
import * as config from '../config';
|
||||||
|
|
||||||
import { LessThanOrEqual } from 'typeorm';
|
import { LessThanOrEqual } from 'typeorm';
|
||||||
|
import { DateUtils } from 'typeorm/util/DateUtils';
|
||||||
|
|
||||||
const ERROR_TRIGGER_TYPE = config.get('nodes.errorTriggerType') as string;
|
const ERROR_TRIGGER_TYPE = config.get('nodes.errorTriggerType') as string;
|
||||||
|
|
||||||
|
@ -112,8 +113,11 @@ function pruneExecutionData(this: WorkflowHooks): void {
|
||||||
const date = new Date(); // today
|
const date = new Date(); // today
|
||||||
date.setHours(date.getHours() - maxAge);
|
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
|
// 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 =>
|
.then(data =>
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
throttling = false;
|
throttling = false;
|
||||||
|
|
Loading…
Reference in a new issue