WAIT_TIME_UNLIMITED -> WAIT_INDEFINITELY

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-12-06 11:19:49 +01:00
parent f3e63ee724
commit c66a7bd335
No known key found for this signature in database
11 changed files with 30 additions and 34 deletions

View file

@ -14,7 +14,7 @@ import type {
RelatedExecution, RelatedExecution,
IExecuteWorkflowInfo, IExecuteWorkflowInfo,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError, NodeHelpers, WAIT_TIME_UNLIMITED } from 'n8n-workflow'; import { ApplicationError, NodeHelpers, WAIT_INDEFINITELY } from 'n8n-workflow';
import Container from 'typedi'; import Container from 'typedi';
import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import { BinaryDataService } from '@/BinaryData/BinaryData.service';
@ -235,7 +235,7 @@ export const describeCommonTests = (
}); });
expect(additionalData.setExecutionStatus).toHaveBeenCalledWith('waiting'); expect(additionalData.setExecutionStatus).toHaveBeenCalledWith('waiting');
expect(runExecutionData.waitTill).toEqual(new Date(WAIT_TIME_UNLIMITED)); expect(runExecutionData.waitTill).toEqual(WAIT_INDEFINITELY);
expect(result.waitTill).toBe(waitTill); expect(result.waitTill).toBe(waitTill);
}); });
}); });

View file

@ -22,12 +22,7 @@ import type {
ISourceData, ISourceData,
AiEvent, AiEvent,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import { ApplicationError, NodeHelpers, WAIT_INDEFINITELY, WorkflowDataProxy } from 'n8n-workflow';
ApplicationError,
NodeHelpers,
WAIT_TIME_UNLIMITED,
WorkflowDataProxy,
} from 'n8n-workflow';
import { Container } from 'typedi'; import { Container } from 'typedi';
import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import { BinaryDataService } from '@/BinaryData/BinaryData.service';
@ -131,7 +126,7 @@ export class BaseExecuteContext extends NodeExecutionContext {
if (result.waitTill) { if (result.waitTill) {
// then put the parent workflow execution also into the waiting state, // then put the parent workflow execution also into the waiting state,
// but do not use the sub-workflow `waitTill` to avoid WaitTracker resuming the parent execution at the same time as the sub-workflow // but do not use the sub-workflow `waitTill` to avoid WaitTracker resuming the parent execution at the same time as the sub-workflow
await this.putExecutionToWait(new Date(WAIT_TIME_UNLIMITED)); await this.putExecutionToWait(WAIT_INDEFINITELY);
} }
const data = await this.binaryDataService.duplicateBinaryData( const data = await this.binaryDataService.duplicateBinaryData(

View file

@ -9,7 +9,6 @@ import {
SIMULATE_NODE_TYPE, SIMULATE_NODE_TYPE,
SIMULATE_TRIGGER_NODE_TYPE, SIMULATE_TRIGGER_NODE_TYPE,
WAIT_NODE_TYPE, WAIT_NODE_TYPE,
WAIT_TIME_UNLIMITED,
} from '@/constants'; } from '@/constants';
import type { import type {
ExecutionSummary, ExecutionSummary,
@ -18,7 +17,12 @@ import type {
NodeOperationError, NodeOperationError,
Workflow, Workflow,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeConnectionType, NodeHelpers, SEND_AND_WAIT_OPERATION } from 'n8n-workflow'; import {
NodeConnectionType,
NodeHelpers,
SEND_AND_WAIT_OPERATION,
WAIT_INDEFINITELY,
} from 'n8n-workflow';
import type { StyleValue } from 'vue'; import type { StyleValue } from 'vue';
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from 'vue';
import xss from 'xss'; import xss from 'xss';
@ -345,7 +349,7 @@ const waiting = computed(() => {
return i18n.baseText('node.theNodeIsWaitingFormCall'); return i18n.baseText('node.theNodeIsWaitingFormCall');
} }
const waitDate = new Date(workflowExecution.waitTill); const waitDate = new Date(workflowExecution.waitTill);
if (waitDate.toISOString() === WAIT_TIME_UNLIMITED) { if (waitDate.getTime() === WAIT_INDEFINITELY.getTime()) {
return i18n.baseText('node.theNodeIsWaitingIndefinitelyForAnIncomingWebhookCall'); return i18n.baseText('node.theNodeIsWaitingIndefinitelyForAnIncomingWebhookCall');
} }
return i18n.baseText('node.nodeIsWaitingTill', { return i18n.baseText('node.nodeIsWaitingTill', {

View file

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, useCssModule } from 'vue'; import { ref, computed, useCssModule } from 'vue';
import type { ExecutionSummary } from 'n8n-workflow'; import type { ExecutionSummary } from 'n8n-workflow';
import { WAIT_INDEFINITELY } from 'n8n-workflow';
import { useI18n } from '@/composables/useI18n'; import { useI18n } from '@/composables/useI18n';
import { WAIT_TIME_UNLIMITED } from '@/constants';
import { convertToDisplayDate } from '@/utils/formatters/dateFormatter'; import { convertToDisplayDate } from '@/utils/formatters/dateFormatter';
import { i18n as locale } from '@/plugins/i18n'; import { i18n as locale } from '@/plugins/i18n';
import ExecutionsTime from '@/components/executions/ExecutionsTime.vue'; import ExecutionsTime from '@/components/executions/ExecutionsTime.vue';
@ -52,7 +52,7 @@ const isWaitTillIndefinite = computed(() => {
return false; return false;
} }
return new Date(props.execution.waitTill).toISOString() === WAIT_TIME_UNLIMITED; return new Date(props.execution.waitTill).getTime() === WAIT_INDEFINITELY.getTime();
}); });
const isRetriable = computed(() => executionHelpers.isExecutionRetriable(props.execution)); const isRetriable = computed(() => executionHelpers.isExecutionRetriable(props.execution));

View file

@ -37,15 +37,14 @@ import type {
ITaskData, ITaskData,
Workflow, Workflow,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeConnectionType, NodeHelpers, SEND_AND_WAIT_OPERATION } from 'n8n-workflow';
import type { INodeUi } from '@/Interface';
import { import {
CUSTOM_API_CALL_KEY, NodeConnectionType,
FORM_NODE_TYPE, NodeHelpers,
STICKY_NODE_TYPE, SEND_AND_WAIT_OPERATION,
WAIT_NODE_TYPE, WAIT_INDEFINITELY,
WAIT_TIME_UNLIMITED, } from 'n8n-workflow';
} from '@/constants'; import type { INodeUi } from '@/Interface';
import { CUSTOM_API_CALL_KEY, FORM_NODE_TYPE, STICKY_NODE_TYPE, WAIT_NODE_TYPE } from '@/constants';
import { sanitizeHtml } from '@/utils/htmlUtils'; import { sanitizeHtml } from '@/utils/htmlUtils';
import { MarkerType } from '@vue-flow/core'; import { MarkerType } from '@vue-flow/core';
import { useNodeHelpers } from './useNodeHelpers'; import { useNodeHelpers } from './useNodeHelpers';
@ -419,7 +418,7 @@ export function useCanvasMapping({
const waitDate = new Date(workflowExecution.waitTill); const waitDate = new Date(workflowExecution.waitTill);
if (waitDate.toISOString() === WAIT_TIME_UNLIMITED) { if (waitDate.getTime() === WAIT_INDEFINITELY.getTime()) {
acc[node.id] = i18n.baseText( acc[node.id] = i18n.baseText(
'node.theNodeIsWaitingIndefinitelyForAnIncomingWebhookCall', 'node.theNodeIsWaitingIndefinitelyForAnIncomingWebhookCall',
); );

View file

@ -300,7 +300,6 @@ export const NODE_CONNECTION_TYPE_ALLOW_MULTIPLE: NodeConnectionType[] = [
// General // General
export const INSTANCE_ID_HEADER = 'n8n-instance-id'; export const INSTANCE_ID_HEADER = 'n8n-instance-id';
export const WAIT_TIME_UNLIMITED = '3000-01-01T00:00:00.000Z';
/** PERSONALIZATION SURVEY */ /** PERSONALIZATION SURVEY */
export const EMAIL_KEY = 'email'; export const EMAIL_KEY = 'email';

View file

@ -7,7 +7,6 @@ import type {
NodeTypeAndVersion, NodeTypeAndVersion,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
WAIT_TIME_UNLIMITED,
Node, Node,
updateDisplayOptions, updateDisplayOptions,
NodeOperationError, NodeOperationError,
@ -16,6 +15,7 @@ import {
tryToParseJsonToFormFields, tryToParseJsonToFormFields,
NodeConnectionType, NodeConnectionType,
WAIT_NODE_TYPE, WAIT_NODE_TYPE,
WAIT_INDEFINITELY,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { formDescription, formFields, formTitle } from '../Form/common.descriptions'; import { formDescription, formFields, formTitle } from '../Form/common.descriptions';
@ -409,8 +409,7 @@ export class Form extends Node {
} }
if (operation !== 'completion') { if (operation !== 'completion') {
const waitTill = new Date(WAIT_TIME_UNLIMITED); await context.putExecutionToWait(WAIT_INDEFINITELY);
await context.putExecutionToWait(waitTill);
} else { } else {
const staticData = context.getWorkflowStaticData('node'); const staticData = context.getWorkflowStaticData('node');
const completionTitle = context.getNodeParameter('completionTitle', 0, '') as string; const completionTitle = context.getNodeParameter('completionTitle', 0, '') as string;

View file

@ -12,7 +12,7 @@ import {
NodeConnectionType, NodeConnectionType,
NodeOperationError, NodeOperationError,
SEND_AND_WAIT_OPERATION, SEND_AND_WAIT_OPERATION,
WAIT_TIME_UNLIMITED, WAIT_INDEFINITELY,
} from 'n8n-workflow'; } from 'n8n-workflow';
import type { IEmail } from '../../../../utils/sendAndWait/interfaces'; import type { IEmail } from '../../../../utils/sendAndWait/interfaces';
@ -270,7 +270,7 @@ export class GmailV2 implements INodeType {
raw: await encodeEmail(email), raw: await encodeEmail(email),
}); });
await this.putExecutionToWait(new Date(WAIT_TIME_UNLIMITED)); await this.putExecutionToWait(WAIT_INDEFINITELY);
return [this.getInputData()]; return [this.getInputData()];
} }

View file

@ -20,7 +20,7 @@ import {
NodeConnectionType, NodeConnectionType,
NodeOperationError, NodeOperationError,
SEND_AND_WAIT_OPERATION, SEND_AND_WAIT_OPERATION,
WAIT_TIME_UNLIMITED, WAIT_INDEFINITELY,
} from 'n8n-workflow'; } from 'n8n-workflow';
import moment from 'moment-timezone'; import moment from 'moment-timezone';
@ -379,7 +379,7 @@ export class SlackV2 implements INodeType {
createSendAndWaitMessageBody(this), createSendAndWaitMessageBody(this),
); );
await this.putExecutionToWait(new Date(WAIT_TIME_UNLIMITED)); await this.putExecutionToWait(WAIT_INDEFINITELY);
return [this.getInputData()]; return [this.getInputData()];
} }

View file

@ -7,7 +7,7 @@ import type {
IDisplayOptions, IDisplayOptions,
IWebhookFunctions, IWebhookFunctions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { WAIT_TIME_UNLIMITED, NodeOperationError, NodeConnectionType } from 'n8n-workflow'; import { NodeOperationError, NodeConnectionType, WAIT_INDEFINITELY } from 'n8n-workflow';
import { import {
authenticationProperty, authenticationProperty,
@ -516,7 +516,7 @@ export class Wait extends Webhook {
} }
private async configureAndPutToWait(context: IExecuteFunctions) { private async configureAndPutToWait(context: IExecuteFunctions) {
let waitTill = new Date(WAIT_TIME_UNLIMITED); let waitTill = WAIT_INDEFINITELY;
const limitWaitTime = context.getNodeParameter('limitWaitTime', 0); const limitWaitTime = context.getNodeParameter('limitWaitTime', 0);
if (limitWaitTime === true) { if (limitWaitTime === true) {

View file

@ -6,7 +6,7 @@ export const LOWERCASE_LETTERS = UPPERCASE_LETTERS.toLowerCase();
export const ALPHABET = [DIGITS, UPPERCASE_LETTERS, LOWERCASE_LETTERS].join(''); export const ALPHABET = [DIGITS, UPPERCASE_LETTERS, LOWERCASE_LETTERS].join('');
export const BINARY_ENCODING = 'base64'; export const BINARY_ENCODING = 'base64';
export const WAIT_TIME_UNLIMITED = '3000-01-01T00:00:00.000Z'; export const WAIT_INDEFINITELY = new Date('3000-01-01T00:00:00.000Z');
export const LOG_LEVELS = ['silent', 'error', 'warn', 'info', 'debug'] as const; export const LOG_LEVELS = ['silent', 'error', 'warn', 'info', 'debug'] as const;