mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(core): Fix worker view (#17052)
This commit is contained in:
22
packages/cli/src/commands/__tests__/worker.test.ts
Normal file
22
packages/cli/src/commands/__tests__/worker.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import { Container } from '@n8n/di';
|
||||
|
||||
import { Worker } from '../worker';
|
||||
|
||||
import { PubSubRegistry } from '@/scaling/pubsub/pubsub.registry';
|
||||
import { Subscriber } from '@/scaling/pubsub/subscriber.service';
|
||||
import { WorkerStatusService } from '@/scaling/worker-status.service.ee';
|
||||
import { RedisClientService } from '@/services/redis-client.service';
|
||||
|
||||
mockInstance(RedisClientService);
|
||||
mockInstance(PubSubRegistry);
|
||||
mockInstance(Subscriber);
|
||||
mockInstance(WorkerStatusService);
|
||||
|
||||
test('should instantiate WorkerStatusService during orchestration setup', async () => {
|
||||
const containerGetSpy = jest.spyOn(Container, 'get');
|
||||
|
||||
await new Worker().initOrchestration();
|
||||
|
||||
expect(containerGetSpy).toHaveBeenCalledWith(WorkerStatusService);
|
||||
});
|
||||
@@ -15,6 +15,7 @@ import type { ScalingService } from '@/scaling/scaling.service';
|
||||
import type { WorkerServerEndpointsConfig } from '@/scaling/worker-server';
|
||||
|
||||
import { BaseCommand } from './base-command';
|
||||
import { WorkerStatusService } from '@/scaling/worker-status.service.ee';
|
||||
|
||||
const flagsSchema = z.object({
|
||||
concurrency: z.number().int().default(10).describe('How many jobs can run in parallel.'),
|
||||
@@ -129,6 +130,7 @@ export class Worker extends BaseCommand<z.infer<typeof flagsSchema>> {
|
||||
|
||||
Container.get(PubSubRegistry).init();
|
||||
await Container.get(Subscriber).subscribe('n8n.commands');
|
||||
Container.get(WorkerStatusService);
|
||||
}
|
||||
|
||||
async setConcurrency() {
|
||||
|
||||
Reference in New Issue
Block a user