fixed deps
This commit is contained in:
parent
24768446f5
commit
947b1d748d
14 changed files with 166 additions and 257 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Core exports
|
||||
export { Queue, type QueueWorkerConfig } from './queue';
|
||||
export { Queue } from './queue';
|
||||
export { QueueManager } from './queue-manager';
|
||||
export { SmartQueueManager } from './smart-queue-manager';
|
||||
export { ServiceCache, createServiceCache } from './service-cache';
|
||||
|
|
@ -32,7 +32,6 @@ export type {
|
|||
JobData,
|
||||
JobOptions,
|
||||
QueueOptions,
|
||||
QueueStats,
|
||||
GlobalStats,
|
||||
|
||||
// Batch processing types
|
||||
|
|
@ -46,6 +45,8 @@ export type {
|
|||
HandlerConfig,
|
||||
HandlerConfigWithSchedule,
|
||||
HandlerInitializer,
|
||||
QueueStats,
|
||||
QueueWorkerConfig,
|
||||
|
||||
// Configuration types
|
||||
RedisConfig,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Queue as BullQueue, QueueEvents, Worker, type Job } from 'bullmq';
|
||||
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';
|
||||
|
||||
// Logger interface for type safety
|
||||
|
|
@ -116,9 +116,9 @@ export class Queue {
|
|||
name: string,
|
||||
data: JobData,
|
||||
cronPattern: string,
|
||||
options: JobOptions = {}
|
||||
options: ExtendedJobOptions = {}
|
||||
): Promise<Job> {
|
||||
const scheduledOptions: JobOptions = {
|
||||
const scheduledOptions: ExtendedJobOptions = {
|
||||
...options,
|
||||
repeat: {
|
||||
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 {
|
||||
HandlerConfig,
|
||||
HandlerConfigWithSchedule, JobHandler, ScheduledJob, TypedJobHandler
|
||||
HandlerConfigWithSchedule,
|
||||
JobHandler,
|
||||
ScheduledJob,
|
||||
TypedJobHandler,
|
||||
JobData,
|
||||
JobOptions,
|
||||
QueueWorkerConfig,
|
||||
QueueStats
|
||||
} from '@stock-bot/types';
|
||||
|
||||
// Types for queue operations
|
||||
export interface JobData<T = unknown> {
|
||||
handler: string;
|
||||
operation: string;
|
||||
payload: T;
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
export interface ProcessOptions {
|
||||
totalDelayHours: number;
|
||||
batchSize?: number;
|
||||
|
|
@ -42,16 +44,8 @@ export interface RedisConfig {
|
|||
db?: number;
|
||||
}
|
||||
|
||||
export interface JobOptions {
|
||||
priority?: number;
|
||||
delay?: number;
|
||||
attempts?: number;
|
||||
removeOnComplete?: number;
|
||||
removeOnFail?: number;
|
||||
backoff?: {
|
||||
type: 'exponential' | 'fixed';
|
||||
delay: number;
|
||||
};
|
||||
// Extended job options specific to this queue implementation
|
||||
export interface ExtendedJobOptions extends JobOptions {
|
||||
repeat?: {
|
||||
pattern?: string;
|
||||
key?: string;
|
||||
|
|
@ -62,7 +56,7 @@ export interface JobOptions {
|
|||
}
|
||||
|
||||
export interface QueueOptions {
|
||||
defaultJobOptions?: JobOptions;
|
||||
defaultJobOptions?: ExtendedJobOptions;
|
||||
workers?: number;
|
||||
concurrency?: number;
|
||||
enableMetrics?: boolean;
|
||||
|
|
@ -80,16 +74,7 @@ export interface QueueManagerConfig {
|
|||
delayWorkerStart?: boolean; // If true, workers won't start automatically
|
||||
}
|
||||
|
||||
export interface QueueStats {
|
||||
waiting: number;
|
||||
active: number;
|
||||
completed: number;
|
||||
failed: number;
|
||||
delayed: number;
|
||||
paused: boolean;
|
||||
workers?: number;
|
||||
}
|
||||
|
||||
// Queue-specific stats that extend the base types
|
||||
export interface GlobalStats {
|
||||
queues: Record<string, QueueStats>;
|
||||
totalJobs: number;
|
||||
|
|
@ -108,6 +93,7 @@ export interface QueueConfig extends QueueManagerConfig {
|
|||
}
|
||||
|
||||
|
||||
// Extended batch job data for queue implementation
|
||||
export interface BatchJobData {
|
||||
payloadKey: string;
|
||||
batchIndex: number;
|
||||
|
|
@ -156,7 +142,7 @@ export interface ScheduleConfig {
|
|||
pattern: string;
|
||||
jobName: string;
|
||||
data?: unknown;
|
||||
options?: JobOptions;
|
||||
options?: ExtendedJobOptions;
|
||||
}
|
||||
|
||||
// Smart Queue Types
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue