feat(API): Report unhandled app crashes to Sentry (#4548)

* SIGTERM/SIGINT should only be handled once

* move error-handling initialization to commands

* create a new `sleep` function in workflow utils

* detect crashes and report them to Sentry
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-11-08 17:06:00 +01:00
committed by GitHub
parent 5d852f9230
commit 2425c10b2b
17 changed files with 129 additions and 73 deletions

View File

@@ -10,6 +10,7 @@ import {
INodeTypeDescription,
NodeApiError,
NodeOperationError,
sleep,
} from 'n8n-workflow';
import { OptionsWithUri } from 'request';
@@ -667,7 +668,7 @@ export class HttpRequestV1 implements INodeType {
const batchSize: number =
(options.batchSize as number) > 0 ? (options.batchSize as number) : 1;
if (itemIndex % batchSize === 0) {
await new Promise((resolve) => setTimeout(resolve, options.batchInterval as number));
await sleep(options.batchInterval as number);
}
}

View File

@@ -8,6 +8,7 @@ import {
INodeTypeDescription,
NodeApiError,
NodeOperationError,
sleep,
} from 'n8n-workflow';
import { OptionsWithUri } from 'request';
@@ -701,7 +702,7 @@ export class HttpRequestV2 implements INodeType {
const batchSize: number =
(options.batchSize as number) > 0 ? (options.batchSize as number) : 1;
if (itemIndex % batchSize === 0) {
await new Promise((resolve) => setTimeout(resolve, options.batchInterval as number));
await sleep(options.batchInterval as number);
}
}

View File

@@ -9,6 +9,7 @@ import {
jsonParse,
NodeApiError,
NodeOperationError,
sleep,
} from 'n8n-workflow';
import { OptionsWithUri } from 'request-promise-native';
@@ -1002,7 +1003,7 @@ export class HttpRequestV3 implements INodeType {
if (itemIndex > 0 && batchSize >= 0 && batchInterval > 0) {
if (itemIndex % batchSize === 0) {
await new Promise((resolve) => setTimeout(resolve, batchInterval));
await sleep(batchInterval);
}
}