n8n/packages/workflow/src
Iván Ovejero c857e42677
feat(core): Coordinate workflow activation in multiple main scenario in internal API (#7566)
Story: https://linear.app/n8n/issue/PAY-926

This PR coordinates workflow activation on instance startup and on
leadership change in multiple main scenario in the internal API. Part 3
on manual workflow activation and deactivation will be a separate PR.

### Part 1: Instance startup

In multi-main scenario, on starting an instance...
- [x] If the instance is the leader, it should add webhooks, triggers
and pollers.
- [x] If the instance is the follower, it should not add webhooks,
triggers or pollers.
- [x] Unit tests.

### Part 2: Leadership change 

In multi-main scenario, if the main instance leader dies…

- [x] The new main instance leader must activate all trigger- and
poller-based workflows, excluding webhook-based workflows.
- [x] The old main instance leader must deactivate all trigger- and
poller-based workflows, excluding webhook-based workflows.
- [x] Unit tests.

To test, start two instances and check behavior on startup and
leadership change:

```
EXECUTIONS_MODE=queue N8N_LEADER_SELECTION_ENABLED=true N8N_LICENSE_TENANT_ID=... N8N_LICENSE_ACTIVATION_KEY=... N8N_LOG_LEVEL=debug npm run start

EXECUTIONS_MODE=queue N8N_LEADER_SELECTION_ENABLED=true N8N_LICENSE_TENANT_ID=... N8N_LICENSE_ACTIVATION_KEY=... N8N_LOG_LEVEL=debug N8N_PORT=5679 npm run start
```
2023-11-07 13:48:48 +01:00
..
Extensions docs(editor): Update .round() function in NumberExtensions.ts for clarity (#7150) 2023-09-12 09:24:29 +01:00
NativeMethods feat(editor): Add missing documentation to autocomplete items for inline code editor (#5560) 2023-02-28 07:34:03 +03:00
AugmentObject.ts refactor(core): Use a Set for deletedProperties in AugmentObject (no-changelog) (#7131) 2023-09-07 15:07:32 +02:00
Authentication.ts refactor(core)!: Remove basic-auth, external-jwt-auth, and no-auth options (#6362) 2023-06-22 20:03:47 +02:00
Constants.ts refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
Cron.ts [N8N-4339] Unify all Cron-specific code. Improve typing, and add tests. (#3887) 2022-08-19 12:45:04 +02:00
DeferredPromise.ts refactor(core): Stop importing LoggerProxy and createDeferredPromise in nodes-base (no-changelog) (#5742) 2023-03-22 14:04:15 +01:00
ErrorReporterProxy.ts fix(core): Error reporter should log all error on an error-chain (no-changelog) (#5342) 2023-02-03 13:53:51 +01:00
ExecutionStatus.ts refactor: Stop using .d.ts files for type-collection files (no-changelog) (#6634) 2023-07-10 19:35:34 +02:00
Expression.ts refactor(core): Avoid passing around static state like default timezone (no-changelog) (#7221) 2023-10-27 14:17:52 +02:00
ExpressionError.ts fix(core)!: Allow syntax errors and expression errors to fail executions (#6352) 2023-06-22 21:04:59 +02:00
ExpressionEvaluatorProxy.ts feat(core): Add Tournament as the new default expression evaluator (#6964) 2023-09-21 13:57:45 +01:00
GlobalState.ts refactor(core): Avoid passing around static state like default timezone (no-changelog) (#7221) 2023-10-27 14:17:52 +02:00
index.ts refactor(core): Avoid passing around static state like default timezone (no-changelog) (#7221) 2023-10-27 14:17:52 +02:00
Interfaces.ts feat(core): Coordinate workflow activation in multiple main scenario in internal API (#7566) 2023-11-07 13:48:48 +01:00
LoggerProxy.ts refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
MessageEventBus.ts refactor(core): Forbid raw enums (no-changelog) 2023-04-21 14:23:15 +03:00
NodeErrors.ts fix(HTTP Request Node): Add suggestion how to fix '429 - too many requests' errors (#7293) 2023-09-28 16:00:45 +02:00
NodeHelpers.ts feat(core): Add optional Error-Output (#7460) 2023-10-30 18:42:47 +01:00
ObservableObject.ts refactor: Clear unused ESLint directives from BE packages (no-changelog) (#6798) 2023-07-31 11:00:48 +02:00
RoutingNode.ts refactor(core): Enable useUnknownInCatchVariables in workflow package (no-changelog) (#7549) 2023-10-31 13:59:33 +01:00
TelemetryHelpers.ts feat(core): Add the node version to telemetry in node_graph_string (#7449) 2023-11-02 15:18:41 +02:00
type-guards.ts feat(editor): Implement Resource Mapper component (#6207) 2023-05-31 11:56:09 +02:00
types.d.ts fix(core): Serialize BigInts (#6805) 2023-07-31 16:53:30 +02:00
utils.ts fix(editor): Sanitize HTML binary-data before rendering in the UI (#7400) 2023-10-11 12:09:19 +02:00
VersionedNodeType.ts refactor: rename NodeVersionedType to VersionedNodeType and move it to the workflow package (#4443) 2022-10-25 21:33:12 +02:00
Workflow.ts feat(core): Add support for building LLM applications (#7235) 2023-10-02 17:33:43 +02:00
WorkflowActivationError.ts feat(core): Coordinate workflow activation in multiple main scenario in internal API (#7566) 2023-11-07 13:48:48 +01:00
WorkflowDataProxy.ts feat(core): Add optional Error-Output (#7460) 2023-10-30 18:42:47 +01:00
WorkflowErrors.ts refactor(core): Stop reporting non-error to sentry (issue 4229454473) (no-changelog) (#7525) 2023-10-27 09:25:07 +02:00
WorkflowHooks.ts refactor: Clear unused ESLint directives from BE packages (no-changelog) (#6798) 2023-07-31 11:00:48 +02:00