removed dep methods
This commit is contained in:
parent
190b725149
commit
4d7c7df909
2 changed files with 20 additions and 96 deletions
|
|
@ -26,7 +26,6 @@ interface Logger {
|
|||
* Main entry point for all queue operations with getQueue() method
|
||||
*/
|
||||
export class QueueManager {
|
||||
private static instance: QueueManager | null = null;
|
||||
private queues = new Map<string, Queue>();
|
||||
private caches = new Map<string, CacheProvider>();
|
||||
private rateLimiter?: QueueRateLimiter;
|
||||
|
|
@ -56,87 +55,6 @@ export class QueueManager {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use dependency injection instead. This method will be removed in a future version.
|
||||
* Get the singleton instance
|
||||
* @throws Error if not initialized - use initialize() first
|
||||
*/
|
||||
static getInstance(): QueueManager {
|
||||
// Deprecated warning - using console since we don't have a logger instance
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'QueueManager.getInstance() is deprecated. Please use dependency injection instead.'
|
||||
);
|
||||
if (!QueueManager.instance) {
|
||||
throw new Error('QueueManager not initialized. Call QueueManager.initialize(config) first.');
|
||||
}
|
||||
return QueueManager.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use dependency injection instead. This method will be removed in a future version.
|
||||
* Initialize the singleton with config
|
||||
* Must be called before getInstance()
|
||||
*/
|
||||
static initialize(config: QueueManagerConfig): QueueManager {
|
||||
// Deprecated warning - using console since we don't have a logger instance
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'QueueManager.initialize() is deprecated. Please use dependency injection instead.'
|
||||
);
|
||||
if (QueueManager.instance) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('QueueManager already initialized, returning existing instance');
|
||||
return QueueManager.instance;
|
||||
}
|
||||
QueueManager.instance = new QueueManager(config);
|
||||
return QueueManager.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use dependency injection instead. This method will be removed in a future version.
|
||||
* Get or initialize the singleton
|
||||
* Convenience method that combines initialize and getInstance
|
||||
*/
|
||||
static getOrInitialize(config?: QueueManagerConfig): QueueManager {
|
||||
// Deprecated warning - using console since we don't have a logger instance
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'QueueManager.getOrInitialize() is deprecated. Please use dependency injection instead.'
|
||||
);
|
||||
if (QueueManager.instance) {
|
||||
return QueueManager.instance;
|
||||
}
|
||||
|
||||
if (!config) {
|
||||
throw new Error(
|
||||
'QueueManager not initialized and no config provided. ' +
|
||||
'Either call initialize(config) first or provide config to getOrInitialize(config).'
|
||||
);
|
||||
}
|
||||
|
||||
return QueueManager.initialize(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use dependency injection instead. This method will be removed in a future version.
|
||||
* Check if the QueueManager is initialized
|
||||
*/
|
||||
static isInitialized(): boolean {
|
||||
return QueueManager.instance !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use dependency injection instead. This method will be removed in a future version.
|
||||
* Reset the singleton (mainly for testing)
|
||||
*/
|
||||
static async reset(): Promise<void> {
|
||||
if (QueueManager.instance) {
|
||||
await QueueManager.instance.shutdown();
|
||||
QueueManager.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create a queue - unified method that handles both scenarios
|
||||
* This is the main method for accessing queues
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue