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:
committed by
GitHub
parent
5d852f9230
commit
2425c10b2b
@@ -7,6 +7,7 @@ import {
|
||||
jsonParse,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
sleep,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { DiscordAttachment, DiscordWebhook } from './Interfaces';
|
||||
@@ -244,7 +245,7 @@ export class Discord implements INodeType {
|
||||
// remaining requests 0
|
||||
// https://discord.com/developers/docs/topics/rate-limits
|
||||
if (!+remainingRatelimit) {
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, resetAfter || 1000));
|
||||
await sleep(resetAfter ?? 1000);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -255,7 +256,7 @@ export class Discord implements INodeType {
|
||||
if (error.statusCode === 429) {
|
||||
const retryAfter = error.response?.headers['retry-after'] || 1000;
|
||||
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, +retryAfter));
|
||||
await sleep(+retryAfter);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user