fixing batch before moving to the apps
This commit is contained in:
parent
8c2f98e010
commit
3534a2c47b
14 changed files with 43 additions and 884 deletions
|
|
@ -7,8 +7,7 @@ import type {
|
|||
QueueOptions,
|
||||
GlobalStats,
|
||||
QueueStats,
|
||||
RateLimitRule,
|
||||
RedisConfig
|
||||
RateLimitRule
|
||||
} from './types';
|
||||
import { getRedisConnection } from './utils';
|
||||
|
||||
|
|
@ -127,7 +126,7 @@ export class QueueManager {
|
|||
const queueConfig: QueueWorkerConfig = {
|
||||
workers: mergedOptions.workers,
|
||||
concurrency: mergedOptions.concurrency,
|
||||
startWorker: mergedOptions.workers && mergedOptions.workers > 0,
|
||||
startWorker: !!mergedOptions.workers && mergedOptions.workers > 0,
|
||||
};
|
||||
|
||||
const queue = new Queue(
|
||||
|
|
@ -387,7 +386,7 @@ export class QueueManager {
|
|||
try {
|
||||
await queue.close();
|
||||
} catch (error) {
|
||||
logger.warn('Error closing queue', { error: error.message });
|
||||
logger.warn('Error closing queue', { error: (error as Error).message });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -396,16 +395,10 @@ export class QueueManager {
|
|||
// Close all caches
|
||||
const cacheShutdownPromises = Array.from(this.caches.values()).map(async (cache) => {
|
||||
try {
|
||||
// Try different disconnect methods as different cache providers may use different names
|
||||
if (typeof cache.disconnect === 'function') {
|
||||
await cache.disconnect();
|
||||
} else if (typeof cache.close === 'function') {
|
||||
await cache.close();
|
||||
} else if (typeof cache.quit === 'function') {
|
||||
await cache.quit();
|
||||
}
|
||||
// Clear cache before shutdown
|
||||
await cache.clear();
|
||||
} catch (error) {
|
||||
logger.warn('Error closing cache', { error: error.message });
|
||||
logger.warn('Error clearing cache', { error: (error as Error).message });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -417,7 +410,7 @@ export class QueueManager {
|
|||
|
||||
logger.info('QueueManager shutdown complete');
|
||||
} catch (error) {
|
||||
logger.error('Error during shutdown', { error: error.message });
|
||||
logger.error('Error during shutdown', { error: (error as Error).message });
|
||||
throw error;
|
||||
} finally {
|
||||
// Reset shutdown state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue