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