mirror of
https://github.com/n8n-io/n8n.git
synced 2026-08-29 01:39:24 +08:00
feat(core): Add flag to run system tasks on the durable scheduler (no-changelog) (#37038)
This commit is contained in:
@@ -44,6 +44,7 @@ describe('SchedulerConfig', () => {
|
||||
expect(scheduler.maxAttempts).toBe(5);
|
||||
expect(scheduler.enabledForPollTriggers).toBe(false);
|
||||
expect(scheduler.pollTimeoutSeconds).toBe(45);
|
||||
expect(scheduler.enabledForSystemTasks).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,6 +76,7 @@ describe('SchedulerConfig', () => {
|
||||
vi.stubEnv('N8N_SCHEDULER_MAX_ATTEMPTS', '3');
|
||||
vi.stubEnv('N8N_SCHEDULER_POLL_TRIGGERS_ENABLED', 'true');
|
||||
vi.stubEnv('N8N_SCHEDULER_POLL_TIMEOUT', '30');
|
||||
vi.stubEnv('N8N_SCHEDULER_SYSTEM_TASKS_ENABLED', 'true');
|
||||
|
||||
const { scheduler } = Container.get(GlobalConfig);
|
||||
|
||||
@@ -96,6 +98,7 @@ describe('SchedulerConfig', () => {
|
||||
expect(scheduler.maxAttempts).toBe(3);
|
||||
expect(scheduler.enabledForPollTriggers).toBe(true);
|
||||
expect(scheduler.pollTimeoutSeconds).toBe(30);
|
||||
expect(scheduler.enabledForSystemTasks).toBe(true);
|
||||
});
|
||||
|
||||
it('should expose the durable-scheduler skip escape hatch via env', () => {
|
||||
|
||||
@@ -302,6 +302,21 @@ export class SchedulerConfig {
|
||||
@Env('N8N_POLLER_DURABLE_CURSORS_ENABLED')
|
||||
durableCursorsEnabled: boolean = false;
|
||||
|
||||
/**
|
||||
* Whether n8n's internal maintenance jobs (for example pruning old executions,
|
||||
* compacting insights data, or renewing the license) are scheduled by the
|
||||
* durable scheduler instead of n8n's in-process timers. Off by default;
|
||||
* requires {@link enabled} to also be on.
|
||||
*
|
||||
* In a multi-instance setup, only turn this on once every instance runs a
|
||||
* version of n8n that supports it. While older and newer versions run side by
|
||||
* side (for example during a rolling deploy), the older instances still run
|
||||
* these jobs on their own timers, so the same job could run twice at the
|
||||
* same time.
|
||||
*/
|
||||
@Env('N8N_SCHEDULER_SYSTEM_TASKS_ENABLED')
|
||||
enabledForSystemTasks: boolean = false;
|
||||
|
||||
/**
|
||||
* Temporary escape hatch for the durable-scheduler rollout (preview to GA).
|
||||
* Off by default; intended to be removed once the durable scheduler is GA.
|
||||
|
||||
@@ -483,6 +483,7 @@ describe('GlobalConfig', () => {
|
||||
maxAttempts: 5,
|
||||
misfireGraceSeconds: 60,
|
||||
durableCursorsEnabled: false,
|
||||
enabledForSystemTasks: false,
|
||||
},
|
||||
evaluation: {
|
||||
collectionsEnabled: false,
|
||||
|
||||
Reference in New Issue
Block a user