fixed deps
This commit is contained in:
parent
24768446f5
commit
947b1d748d
14 changed files with 166 additions and 257 deletions
Binary file not shown.
|
|
@ -10,7 +10,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@stock-bot/config": "workspace:*",
|
"@stock-bot/config": "workspace:*",
|
||||||
"@stock-bot/logger": "workspace:*",
|
"@stock-bot/logger": "workspace:*",
|
||||||
"@stock-bot/handlers": "workspace:*"
|
"@stock-bot/types": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/pg": "^8.10.7"
|
"@types/pg": "^8.10.7"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ export * from './operation-context';
|
||||||
export * from './pool-size-calculator';
|
export * from './pool-size-calculator';
|
||||||
export * from './types';
|
export * from './types';
|
||||||
|
|
||||||
|
// Re-export IServiceContainer from types for convenience
|
||||||
|
export type { IServiceContainer } from '@stock-bot/types';
|
||||||
|
|
||||||
// Legacy exports for backward compatibility
|
// Legacy exports for backward compatibility
|
||||||
export {
|
export {
|
||||||
createServiceContainer,
|
createServiceContainer,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
import type { Collection } from 'mongodb';
|
import type { Collection } from 'mongodb';
|
||||||
import { getLogger } from '@stock-bot/logger';
|
import { getLogger } from '@stock-bot/logger';
|
||||||
import type { HandlerConfigWithSchedule } from '@stock-bot/types';
|
import type {
|
||||||
|
HandlerConfigWithSchedule,
|
||||||
|
IServiceContainer,
|
||||||
|
ExecutionContext,
|
||||||
|
IHandler
|
||||||
|
} from '@stock-bot/types';
|
||||||
import { fetch } from '@stock-bot/utils';
|
import { fetch } from '@stock-bot/utils';
|
||||||
import { createNamespacedCache } from '@stock-bot/cache';
|
import { createNamespacedCache } from '@stock-bot/cache';
|
||||||
import type { IServiceContainer } from '@stock-bot/types';
|
|
||||||
import { handlerRegistry } from '../registry/handler-registry';
|
import { handlerRegistry } from '../registry/handler-registry';
|
||||||
import { createJobHandler } from '../utils/create-job-handler';
|
import { createJobHandler } from '../utils/create-job-handler';
|
||||||
import type { ExecutionContext, IHandler } from '../types/types';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job scheduling options
|
* Job scheduling options
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export { handlerRegistry } from './registry/handler-registry';
|
||||||
// Utilities
|
// Utilities
|
||||||
export { createJobHandler } from './utils/create-job-handler';
|
export { createJobHandler } from './utils/create-job-handler';
|
||||||
|
|
||||||
// Types
|
// Re-export types from types package for convenience
|
||||||
export type {
|
export type {
|
||||||
ExecutionContext,
|
ExecutionContext,
|
||||||
IHandler,
|
IHandler,
|
||||||
|
|
@ -19,10 +19,8 @@ export type {
|
||||||
TypedJobHandler,
|
TypedJobHandler,
|
||||||
HandlerMetadata,
|
HandlerMetadata,
|
||||||
OperationMetadata,
|
OperationMetadata,
|
||||||
} from './types/types';
|
IServiceContainer,
|
||||||
|
} from '@stock-bot/types';
|
||||||
// Re-export IServiceContainer from types package
|
|
||||||
export type { IServiceContainer } from '@stock-bot/types';
|
|
||||||
|
|
||||||
// Decorators
|
// Decorators
|
||||||
export {
|
export {
|
||||||
|
|
|
||||||
|
|
@ -1,193 +0,0 @@
|
||||||
import { getLogger } from '@stock-bot/logger';
|
|
||||||
import type {
|
|
||||||
HandlerConfig,
|
|
||||||
HandlerConfigWithSchedule,
|
|
||||||
JobHandler,
|
|
||||||
ScheduledJob,
|
|
||||||
} from '../types/types';
|
|
||||||
|
|
||||||
const logger = getLogger('handler-registry');
|
|
||||||
|
|
||||||
class HandlerRegistry {
|
|
||||||
private handlers = new Map<string, HandlerConfig>();
|
|
||||||
private handlerSchedules = new Map<string, ScheduledJob[]>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a handler with its operations (simple config)
|
|
||||||
*/
|
|
||||||
register(handlerName: string, config: HandlerConfig): void {
|
|
||||||
logger.info(`Registering handler: ${handlerName}`, {
|
|
||||||
operations: Object.keys(config),
|
|
||||||
});
|
|
||||||
|
|
||||||
this.handlers.set(handlerName, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a handler with operations and scheduled jobs (full config)
|
|
||||||
*/
|
|
||||||
registerWithSchedule(config: HandlerConfigWithSchedule): void {
|
|
||||||
logger.info(`Registering handler with schedule: ${config.name}`, {
|
|
||||||
operations: Object.keys(config.operations),
|
|
||||||
scheduledJobs: config.scheduledJobs?.length || 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.handlers.set(config.name, config.operations);
|
|
||||||
|
|
||||||
if (config.scheduledJobs && config.scheduledJobs.length > 0) {
|
|
||||||
this.handlerSchedules.set(config.name, config.scheduledJobs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a handler for a specific handler and operation
|
|
||||||
*/
|
|
||||||
getHandler(handler: string, operation: string): JobHandler | null {
|
|
||||||
const handlerConfig = this.handlers.get(handler);
|
|
||||||
if (!handlerConfig) {
|
|
||||||
logger.warn(`Handler not found: ${handler}`);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const jobHandler = handlerConfig[operation];
|
|
||||||
if (!jobHandler) {
|
|
||||||
logger.warn(`Operation not found: ${handler}:${operation}`, {
|
|
||||||
availableOperations: Object.keys(handlerConfig),
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return jobHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all scheduled jobs from all handlers
|
|
||||||
*/
|
|
||||||
getAllScheduledJobs(): Array<{ handler: string; job: ScheduledJob }> {
|
|
||||||
const allJobs: Array<{ handler: string; job: ScheduledJob }> = [];
|
|
||||||
|
|
||||||
for (const [handlerName, jobs] of this.handlerSchedules) {
|
|
||||||
for (const job of jobs) {
|
|
||||||
allJobs.push({
|
|
||||||
handler: handlerName,
|
|
||||||
job,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return allJobs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get scheduled jobs for a specific handler
|
|
||||||
*/
|
|
||||||
getScheduledJobs(handler: string): ScheduledJob[] {
|
|
||||||
return this.handlerSchedules.get(handler) || [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a handler has scheduled jobs
|
|
||||||
*/
|
|
||||||
hasScheduledJobs(handler: string): boolean {
|
|
||||||
return this.handlerSchedules.has(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all registered handlers with their configurations
|
|
||||||
*/
|
|
||||||
getHandlerConfigs(): Array<{ name: string; operations: string[]; scheduledJobs: number }> {
|
|
||||||
return Array.from(this.handlers.keys()).map(name => ({
|
|
||||||
name,
|
|
||||||
operations: Object.keys(this.handlers.get(name) || {}),
|
|
||||||
scheduledJobs: this.handlerSchedules.get(name)?.length || 0,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all handlers with their full configurations for queue manager registration
|
|
||||||
*/
|
|
||||||
getAllHandlers(): Map<string, { operations: HandlerConfig; scheduledJobs?: ScheduledJob[] }> {
|
|
||||||
const result = new Map<string, { operations: HandlerConfig; scheduledJobs?: ScheduledJob[] }>();
|
|
||||||
|
|
||||||
for (const [name, operations] of this.handlers) {
|
|
||||||
const scheduledJobs = this.handlerSchedules.get(name);
|
|
||||||
result.set(name, {
|
|
||||||
operations,
|
|
||||||
scheduledJobs,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all registered handlers
|
|
||||||
*/
|
|
||||||
getHandlers(): string[] {
|
|
||||||
return Array.from(this.handlers.keys());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get operations for a specific handler
|
|
||||||
*/
|
|
||||||
getOperations(handler: string): string[] {
|
|
||||||
const handlerConfig = this.handlers.get(handler);
|
|
||||||
return handlerConfig ? Object.keys(handlerConfig) : [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a handler exists
|
|
||||||
*/
|
|
||||||
hasHandler(handler: string): boolean {
|
|
||||||
return this.handlers.has(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a handler has a specific operation
|
|
||||||
*/
|
|
||||||
hasOperation(handler: string, operation: string): boolean {
|
|
||||||
const handlerConfig = this.handlers.get(handler);
|
|
||||||
return handlerConfig ? operation in handlerConfig : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a handler
|
|
||||||
*/
|
|
||||||
unregister(handler: string): boolean {
|
|
||||||
this.handlerSchedules.delete(handler);
|
|
||||||
return this.handlers.delete(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear all handlers
|
|
||||||
*/
|
|
||||||
clear(): void {
|
|
||||||
this.handlers.clear();
|
|
||||||
this.handlerSchedules.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get registry statistics
|
|
||||||
*/
|
|
||||||
getStats(): { handlers: number; totalOperations: number; totalScheduledJobs: number } {
|
|
||||||
let totalOperations = 0;
|
|
||||||
let totalScheduledJobs = 0;
|
|
||||||
|
|
||||||
for (const config of this.handlers.values()) {
|
|
||||||
totalOperations += Object.keys(config).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const jobs of this.handlerSchedules.values()) {
|
|
||||||
totalScheduledJobs += jobs.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
handlers: this.handlers.size,
|
|
||||||
totalOperations,
|
|
||||||
totalScheduledJobs,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Export singleton instance
|
|
||||||
export const handlerRegistry = new HandlerRegistry();
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
// Re-export all handler types from the shared types package
|
|
||||||
export type {
|
|
||||||
ExecutionContext,
|
|
||||||
HandlerConfig,
|
|
||||||
HandlerConfigWithSchedule,
|
|
||||||
HandlerMetadata,
|
|
||||||
IHandler,
|
|
||||||
JobHandler,
|
|
||||||
OperationMetadata,
|
|
||||||
ScheduledJob,
|
|
||||||
TypedJobHandler,
|
|
||||||
} from '@stock-bot/types';
|
|
||||||
41
libs/core/types/src/decorators.ts
Normal file
41
libs/core/types/src/decorators.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
* Decorator Type Definitions
|
||||||
|
* Type definitions for handler decorators
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schedule configuration for operations
|
||||||
|
*/
|
||||||
|
export interface ScheduleConfig {
|
||||||
|
cronPattern: string;
|
||||||
|
priority?: number;
|
||||||
|
immediately?: boolean;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorator metadata stored on classes
|
||||||
|
*/
|
||||||
|
export interface DecoratorMetadata {
|
||||||
|
handlerName?: string;
|
||||||
|
operations?: Array<{
|
||||||
|
name: string;
|
||||||
|
methodName: string;
|
||||||
|
schedules?: ScheduleConfig[];
|
||||||
|
}>;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type for decorator factories
|
||||||
|
*/
|
||||||
|
export type DecoratorFactory<T = any> = (target: T, context?: any) => T | void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type for method decorators
|
||||||
|
*/
|
||||||
|
export type MethodDecoratorFactory = (
|
||||||
|
target: any,
|
||||||
|
propertyKey: string,
|
||||||
|
descriptor?: PropertyDescriptor
|
||||||
|
) => any;
|
||||||
|
|
@ -61,6 +61,22 @@ export type {
|
||||||
TypedJobHandler,
|
TypedJobHandler,
|
||||||
} from './handlers';
|
} from './handlers';
|
||||||
|
|
||||||
|
// Export service container interface
|
||||||
// Export service container types
|
|
||||||
export type { IServiceContainer } from './service-container';
|
export type { IServiceContainer } from './service-container';
|
||||||
|
|
||||||
|
// Export decorator types
|
||||||
|
export type {
|
||||||
|
ScheduleConfig,
|
||||||
|
DecoratorMetadata,
|
||||||
|
DecoratorFactory,
|
||||||
|
MethodDecoratorFactory,
|
||||||
|
} from './decorators';
|
||||||
|
|
||||||
|
// Export queue types
|
||||||
|
export type {
|
||||||
|
JobData,
|
||||||
|
JobOptions,
|
||||||
|
QueueStats,
|
||||||
|
BatchJobData,
|
||||||
|
QueueWorkerConfig,
|
||||||
|
} from './queue';
|
||||||
|
|
|
||||||
64
libs/core/types/src/queue.ts
Normal file
64
libs/core/types/src/queue.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
/**
|
||||||
|
* Queue Type Definitions
|
||||||
|
* Types specific to queue operations
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Job data structure for queue operations
|
||||||
|
*/
|
||||||
|
export interface JobData<T = unknown> {
|
||||||
|
handler: string;
|
||||||
|
operation: string;
|
||||||
|
payload: T;
|
||||||
|
priority?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue job options
|
||||||
|
*/
|
||||||
|
export interface JobOptions {
|
||||||
|
priority?: number;
|
||||||
|
delay?: number;
|
||||||
|
attempts?: number;
|
||||||
|
backoff?: {
|
||||||
|
type: 'exponential' | 'fixed';
|
||||||
|
delay: number;
|
||||||
|
};
|
||||||
|
removeOnComplete?: boolean | number;
|
||||||
|
removeOnFail?: boolean | number;
|
||||||
|
timeout?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue statistics
|
||||||
|
*/
|
||||||
|
export interface QueueStats {
|
||||||
|
waiting: number;
|
||||||
|
active: number;
|
||||||
|
completed: number;
|
||||||
|
failed: number;
|
||||||
|
delayed: number;
|
||||||
|
paused: boolean;
|
||||||
|
workers?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch job configuration
|
||||||
|
*/
|
||||||
|
export interface BatchJobData {
|
||||||
|
payloadKey: string;
|
||||||
|
batchIndex: number;
|
||||||
|
totalBatches: number;
|
||||||
|
items: unknown[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue worker configuration
|
||||||
|
*/
|
||||||
|
export interface QueueWorkerConfig {
|
||||||
|
concurrency?: number;
|
||||||
|
maxStalledCount?: number;
|
||||||
|
stalledInterval?: number;
|
||||||
|
lockDuration?: number;
|
||||||
|
lockRenewTime?: number;
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* Universal Service Container for Handlers
|
* Service Container Interface
|
||||||
* Simple, comprehensive container with all services available
|
* Pure interface definition with no dependencies
|
||||||
|
* Used by both DI and Handlers packages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Universal service container with all common services
|
* Universal service container interface
|
||||||
* Designed to work across different service contexts (data-ingestion, processing, etc.)
|
* Provides access to all common services in a type-safe manner
|
||||||
|
* Designed to work across different service contexts
|
||||||
*/
|
*/
|
||||||
export interface IServiceContainer {
|
export interface IServiceContainer {
|
||||||
// Core infrastructure
|
// Core infrastructure
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Core exports
|
// Core exports
|
||||||
export { Queue, type QueueWorkerConfig } from './queue';
|
export { Queue } from './queue';
|
||||||
export { QueueManager } from './queue-manager';
|
export { QueueManager } from './queue-manager';
|
||||||
export { SmartQueueManager } from './smart-queue-manager';
|
export { SmartQueueManager } from './smart-queue-manager';
|
||||||
export { ServiceCache, createServiceCache } from './service-cache';
|
export { ServiceCache, createServiceCache } from './service-cache';
|
||||||
|
|
@ -32,7 +32,6 @@ export type {
|
||||||
JobData,
|
JobData,
|
||||||
JobOptions,
|
JobOptions,
|
||||||
QueueOptions,
|
QueueOptions,
|
||||||
QueueStats,
|
|
||||||
GlobalStats,
|
GlobalStats,
|
||||||
|
|
||||||
// Batch processing types
|
// Batch processing types
|
||||||
|
|
@ -46,6 +45,8 @@ export type {
|
||||||
HandlerConfig,
|
HandlerConfig,
|
||||||
HandlerConfigWithSchedule,
|
HandlerConfigWithSchedule,
|
||||||
HandlerInitializer,
|
HandlerInitializer,
|
||||||
|
QueueStats,
|
||||||
|
QueueWorkerConfig,
|
||||||
|
|
||||||
// Configuration types
|
// Configuration types
|
||||||
RedisConfig,
|
RedisConfig,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Queue as BullQueue, QueueEvents, Worker, type Job } from 'bullmq';
|
import { Queue as BullQueue, QueueEvents, Worker, type Job } from 'bullmq';
|
||||||
import { handlerRegistry } from '@stock-bot/handlers';
|
import { handlerRegistry } from '@stock-bot/handlers';
|
||||||
import type { JobData, JobOptions, QueueStats, RedisConfig } from './types';
|
import type { JobData, JobOptions, ExtendedJobOptions, QueueStats, RedisConfig } from './types';
|
||||||
import { getRedisConnection } from './utils';
|
import { getRedisConnection } from './utils';
|
||||||
|
|
||||||
// Logger interface for type safety
|
// Logger interface for type safety
|
||||||
|
|
@ -116,9 +116,9 @@ export class Queue {
|
||||||
name: string,
|
name: string,
|
||||||
data: JobData,
|
data: JobData,
|
||||||
cronPattern: string,
|
cronPattern: string,
|
||||||
options: JobOptions = {}
|
options: ExtendedJobOptions = {}
|
||||||
): Promise<Job> {
|
): Promise<Job> {
|
||||||
const scheduledOptions: JobOptions = {
|
const scheduledOptions: ExtendedJobOptions = {
|
||||||
...options,
|
...options,
|
||||||
repeat: {
|
repeat: {
|
||||||
pattern: cronPattern,
|
pattern: cronPattern,
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
// Re-export handler types from shared types package
|
// Import types we need to extend
|
||||||
|
import type { JobOptions, QueueStats } from '@stock-bot/types';
|
||||||
|
|
||||||
|
// Re-export handler and queue types from shared types package
|
||||||
export type {
|
export type {
|
||||||
HandlerConfig,
|
HandlerConfig,
|
||||||
HandlerConfigWithSchedule, JobHandler, ScheduledJob, TypedJobHandler
|
HandlerConfigWithSchedule,
|
||||||
|
JobHandler,
|
||||||
|
ScheduledJob,
|
||||||
|
TypedJobHandler,
|
||||||
|
JobData,
|
||||||
|
JobOptions,
|
||||||
|
QueueWorkerConfig,
|
||||||
|
QueueStats
|
||||||
} from '@stock-bot/types';
|
} from '@stock-bot/types';
|
||||||
|
|
||||||
// Types for queue operations
|
|
||||||
export interface JobData<T = unknown> {
|
|
||||||
handler: string;
|
|
||||||
operation: string;
|
|
||||||
payload: T;
|
|
||||||
priority?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProcessOptions {
|
export interface ProcessOptions {
|
||||||
totalDelayHours: number;
|
totalDelayHours: number;
|
||||||
batchSize?: number;
|
batchSize?: number;
|
||||||
|
|
@ -42,16 +44,8 @@ export interface RedisConfig {
|
||||||
db?: number;
|
db?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JobOptions {
|
// Extended job options specific to this queue implementation
|
||||||
priority?: number;
|
export interface ExtendedJobOptions extends JobOptions {
|
||||||
delay?: number;
|
|
||||||
attempts?: number;
|
|
||||||
removeOnComplete?: number;
|
|
||||||
removeOnFail?: number;
|
|
||||||
backoff?: {
|
|
||||||
type: 'exponential' | 'fixed';
|
|
||||||
delay: number;
|
|
||||||
};
|
|
||||||
repeat?: {
|
repeat?: {
|
||||||
pattern?: string;
|
pattern?: string;
|
||||||
key?: string;
|
key?: string;
|
||||||
|
|
@ -62,7 +56,7 @@ export interface JobOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueueOptions {
|
export interface QueueOptions {
|
||||||
defaultJobOptions?: JobOptions;
|
defaultJobOptions?: ExtendedJobOptions;
|
||||||
workers?: number;
|
workers?: number;
|
||||||
concurrency?: number;
|
concurrency?: number;
|
||||||
enableMetrics?: boolean;
|
enableMetrics?: boolean;
|
||||||
|
|
@ -80,16 +74,7 @@ export interface QueueManagerConfig {
|
||||||
delayWorkerStart?: boolean; // If true, workers won't start automatically
|
delayWorkerStart?: boolean; // If true, workers won't start automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueueStats {
|
// Queue-specific stats that extend the base types
|
||||||
waiting: number;
|
|
||||||
active: number;
|
|
||||||
completed: number;
|
|
||||||
failed: number;
|
|
||||||
delayed: number;
|
|
||||||
paused: boolean;
|
|
||||||
workers?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GlobalStats {
|
export interface GlobalStats {
|
||||||
queues: Record<string, QueueStats>;
|
queues: Record<string, QueueStats>;
|
||||||
totalJobs: number;
|
totalJobs: number;
|
||||||
|
|
@ -108,6 +93,7 @@ export interface QueueConfig extends QueueManagerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Extended batch job data for queue implementation
|
||||||
export interface BatchJobData {
|
export interface BatchJobData {
|
||||||
payloadKey: string;
|
payloadKey: string;
|
||||||
batchIndex: number;
|
batchIndex: number;
|
||||||
|
|
@ -156,7 +142,7 @@ export interface ScheduleConfig {
|
||||||
pattern: string;
|
pattern: string;
|
||||||
jobName: string;
|
jobName: string;
|
||||||
data?: unknown;
|
data?: unknown;
|
||||||
options?: JobOptions;
|
options?: ExtendedJobOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Smart Queue Types
|
// Smart Queue Types
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue