removed delayWorkerStart
This commit is contained in:
parent
f6038d385f
commit
c8dcd697c9
10 changed files with 5 additions and 12 deletions
|
|
@ -80,7 +80,6 @@
|
||||||
"workers": 1,
|
"workers": 1,
|
||||||
"concurrency": 1,
|
"concurrency": 1,
|
||||||
"enableScheduledJobs": true,
|
"enableScheduledJobs": true,
|
||||||
"delayWorkerStart": true,
|
|
||||||
"defaultJobOptions": {
|
"defaultJobOptions": {
|
||||||
"attempts": 3,
|
"attempts": 3,
|
||||||
"backoff": {
|
"backoff": {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ if (config.queue) {
|
||||||
config.queue.workers = 0;
|
config.queue.workers = 0;
|
||||||
config.queue.concurrency = 0;
|
config.queue.concurrency = 0;
|
||||||
config.queue.enableScheduledJobs = false;
|
config.queue.enableScheduledJobs = false;
|
||||||
config.queue.delayWorkerStart = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the full configuration
|
// Log the full configuration
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ export const queueConfigSchema = z.object({
|
||||||
workers: z.number().default(1),
|
workers: z.number().default(1),
|
||||||
concurrency: z.number().default(1),
|
concurrency: z.number().default(1),
|
||||||
enableScheduledJobs: z.boolean().default(true),
|
enableScheduledJobs: z.boolean().default(true),
|
||||||
delayWorkerStart: z.boolean().default(true), // ServiceApplication handles worker startup
|
|
||||||
defaultJobOptions: z
|
defaultJobOptions: z
|
||||||
.object({
|
.object({
|
||||||
attempts: z.number().default(3),
|
attempts: z.number().default(3),
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ export const queueConfigSchema = z.object({
|
||||||
workers: z.number().optional().default(1),
|
workers: z.number().optional().default(1),
|
||||||
concurrency: z.number().optional().default(1),
|
concurrency: z.number().optional().default(1),
|
||||||
enableScheduledJobs: z.boolean().optional().default(true),
|
enableScheduledJobs: z.boolean().optional().default(true),
|
||||||
delayWorkerStart: z.boolean().optional().default(false),
|
|
||||||
defaultJobOptions: z
|
defaultJobOptions: z
|
||||||
.object({
|
.object({
|
||||||
attempts: z.number().default(3),
|
attempts: z.number().default(3),
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,6 @@ export class ServiceContainerBuilder {
|
||||||
workers: 1,
|
workers: 1,
|
||||||
concurrency: 1,
|
concurrency: 1,
|
||||||
enableScheduledJobs: true,
|
enableScheduledJobs: true,
|
||||||
delayWorkerStart: false,
|
|
||||||
defaultJobOptions: {
|
defaultJobOptions: {
|
||||||
attempts: 3,
|
attempts: 3,
|
||||||
backoff: { type: 'exponential' as const, delay: 1000 },
|
backoff: { type: 'exponential' as const, delay: 1000 },
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { asClass, asFunction, asValue, type AwilixContainer } from 'awilix';
|
|
||||||
import { Browser } from '@stock-bot/browser';
|
import { Browser } from '@stock-bot/browser';
|
||||||
import { ProxyManager } from '@stock-bot/proxy';
|
import { ProxyManager } from '@stock-bot/proxy';
|
||||||
|
import { asClass, asFunction, asValue, type AwilixContainer } from 'awilix';
|
||||||
import type { AppConfig } from '../config/schemas';
|
import type { AppConfig } from '../config/schemas';
|
||||||
import type { ServiceDefinitions } from '../container/types';
|
import type { ServiceDefinitions } from '../container/types';
|
||||||
|
|
||||||
|
|
@ -76,7 +76,6 @@ export function registerApplicationServices(
|
||||||
defaultJobOptions: config.queue!.defaultJobOptions,
|
defaultJobOptions: config.queue!.defaultJobOptions,
|
||||||
},
|
},
|
||||||
enableScheduledJobs: config.queue!.enableScheduledJobs ?? true,
|
enableScheduledJobs: config.queue!.enableScheduledJobs ?? true,
|
||||||
delayWorkerStart: config.queue!.delayWorkerStart ?? true, // Changed to true so ServiceApplication can start workers
|
|
||||||
autoDiscoverHandlers: true,
|
autoDiscoverHandlers: true,
|
||||||
};
|
};
|
||||||
return new QueueManager(queueConfig, handlerRegistry, logger);
|
return new QueueManager(queueConfig, handlerRegistry, logger);
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ export async function autoRegisterHandlers(
|
||||||
logger.info(`Registering handler: ${handlerName} from ${relativePath}`);
|
logger.info(`Registering handler: ${handlerName} from ${relativePath}`);
|
||||||
|
|
||||||
// Create instance - handlers now auto-register via decorators
|
// Create instance - handlers now auto-register via decorators
|
||||||
const handler = new HandlerClass(services);
|
new HandlerClass(services);
|
||||||
|
|
||||||
registered.push(handlerName);
|
registered.push(handlerName);
|
||||||
logger.info(`Successfully registered handler: ${handlerName}`, {
|
logger.info(`Successfully registered handler: ${handlerName}`, {
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ export class QueueManager {
|
||||||
const queueConfig: QueueWorkerConfig = {
|
const queueConfig: QueueWorkerConfig = {
|
||||||
workers,
|
workers,
|
||||||
concurrency,
|
concurrency,
|
||||||
startWorker: workers > 0 && !this.config.delayWorkerStart,
|
startWorker: workers > 0,
|
||||||
handlerRegistry: options.handlerRegistry || this.handlerRegistry,
|
handlerRegistry: options.handlerRegistry || this.handlerRegistry,
|
||||||
serviceName: this.config.serviceName,
|
serviceName: this.config.serviceName,
|
||||||
};
|
};
|
||||||
|
|
@ -186,7 +186,7 @@ export class QueueManager {
|
||||||
workers: workers,
|
workers: workers,
|
||||||
concurrency: concurrency,
|
concurrency: concurrency,
|
||||||
handlerRegistryProvided: !!this.handlerRegistry,
|
handlerRegistryProvided: !!this.handlerRegistry,
|
||||||
willStartWorkers: workers > 0 && !this.config.delayWorkerStart,
|
willStartWorkers: workers > 0,
|
||||||
isOwnQueue,
|
isOwnQueue,
|
||||||
serviceName: this.serviceName,
|
serviceName: this.serviceName,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,6 @@ export interface QueueManagerConfig {
|
||||||
enableScheduledJobs?: boolean;
|
enableScheduledJobs?: boolean;
|
||||||
globalRateLimit?: RateLimitConfig;
|
globalRateLimit?: RateLimitConfig;
|
||||||
rateLimitRules?: RateLimitRule[]; // Global rate limit rules
|
rateLimitRules?: RateLimitRule[]; // Global rate limit rules
|
||||||
delayWorkerStart?: boolean; // If true, workers won't start automatically
|
|
||||||
serviceName?: string; // For service discovery and namespacing
|
serviceName?: string; // For service discovery and namespacing
|
||||||
autoDiscoverHandlers?: boolean; // Auto-discover queue routes from handler registry
|
autoDiscoverHandlers?: boolean; // Auto-discover queue routes from handler registry
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export interface MongoDBClient {
|
||||||
disconnect(): Promise<void>;
|
disconnect(): Promise<void>;
|
||||||
isConnected(): boolean;
|
isConnected(): boolean;
|
||||||
getDb(dbName?: string): any; // MongoDB Db type
|
getDb(dbName?: string): any; // MongoDB Db type
|
||||||
collection<T = any>(name: string, dbName?: string): any; // MongoDB Collection<T>
|
collection(name: string, dbName?: string): any; // MongoDB Collection
|
||||||
createCollection(name: string, options?: any, dbName?: string): Promise<void>;
|
createCollection(name: string, options?: any, dbName?: string): Promise<void>;
|
||||||
dropCollection(name: string, dbName?: string): Promise<boolean>;
|
dropCollection(name: string, dbName?: string): Promise<boolean>;
|
||||||
listCollections(dbName?: string): Promise<Array<{ name: string; type: string }>>;
|
listCollections(dbName?: string): Promise<Array<{ name: string; type: string }>>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue