mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Override executions mode if regular
during worker startup (#11250)
This commit is contained in:
parent
381766523f
commit
0d40874689
|
@ -61,6 +61,10 @@ export class Worker extends BaseCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(argv: string[], cmdConfig: Config) {
|
constructor(argv: string[], cmdConfig: Config) {
|
||||||
|
if (config.getEnv('executions.mode') !== 'queue') {
|
||||||
|
config.set('executions.mode', 'queue');
|
||||||
|
}
|
||||||
|
|
||||||
super(argv, cmdConfig);
|
super(argv, cmdConfig);
|
||||||
|
|
||||||
if (!process.env.N8N_ENCRYPTION_KEY) {
|
if (!process.env.N8N_ENCRYPTION_KEY) {
|
||||||
|
|
|
@ -35,6 +35,8 @@ mockInstance(Subscriber);
|
||||||
const command = setupTestCommand(Worker);
|
const command = setupTestCommand(Worker);
|
||||||
|
|
||||||
test('worker initializes all its components', async () => {
|
test('worker initializes all its components', async () => {
|
||||||
|
config.set('executions.mode', 'regular'); // should be overridden
|
||||||
|
|
||||||
const worker = await command.run();
|
const worker = await command.run();
|
||||||
expect(worker.queueModeId).toBeDefined();
|
expect(worker.queueModeId).toBeDefined();
|
||||||
expect(worker.queueModeId).toContain('worker');
|
expect(worker.queueModeId).toContain('worker');
|
||||||
|
@ -49,4 +51,6 @@ test('worker initializes all its components', async () => {
|
||||||
expect(logStreamingEventRelay.init).toHaveBeenCalledTimes(1);
|
expect(logStreamingEventRelay.init).toHaveBeenCalledTimes(1);
|
||||||
expect(orchestrationWorkerService.init).toHaveBeenCalledTimes(1);
|
expect(orchestrationWorkerService.init).toHaveBeenCalledTimes(1);
|
||||||
expect(messageEventBus.send).toHaveBeenCalledTimes(1);
|
expect(messageEventBus.send).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
|
expect(config.getEnv('executions.mode')).toBe('queue');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue