feat(worker): log when workers are ready
This commit is contained in:
@@ -6,6 +6,7 @@ type TRedisConfig = {
|
||||
username?: string,
|
||||
password?: string,
|
||||
tls?: Record<string, unknown>,
|
||||
enableReadyCheck?: boolean,
|
||||
enableOfflineQueue: boolean,
|
||||
}
|
||||
|
||||
@@ -15,6 +16,7 @@ const redisConfig: TRedisConfig = {
|
||||
username: appConfig.redisUsername,
|
||||
password: appConfig.redisPassword,
|
||||
enableOfflineQueue: false,
|
||||
enableReadyCheck: true,
|
||||
};
|
||||
|
||||
if (appConfig.redisTls) {
|
||||
|
11
packages/backend/src/helpers/check-worker-readiness.ts
Normal file
11
packages/backend/src/helpers/check-worker-readiness.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import Redis from 'ioredis';
|
||||
import logger from './logger';
|
||||
import redisConfig from '../config/redis';
|
||||
|
||||
const redisClient = new Redis(redisConfig);
|
||||
|
||||
redisClient.on('ready', () => {
|
||||
logger.info(`Workers are ready!`);
|
||||
|
||||
redisClient.disconnect();
|
||||
});
|
@@ -1,4 +1,5 @@
|
||||
import './config/orm';
|
||||
import './helpers/check-worker-readiness';
|
||||
import './workers/flow';
|
||||
import './workers/trigger';
|
||||
import './workers/action';
|
||||
|
Reference in New Issue
Block a user