2026-05-18 03:47:22 +01:00
|
|
|
import 'dotenv/config';
|
|
|
|
|
|
|
|
|
|
import { env } from './config/env';
|
|
|
|
|
import { warnIfFfmpegMissing } from './utils/ffmpeg';
|
|
|
|
|
import { log } from './utils/logger';
|
2026-06-29 12:28:58 +01:00
|
|
|
import { connectRedis } from '@cio/core/utils/redis/redis';
|
2026-05-18 03:47:22 +01:00
|
|
|
|
|
|
|
|
void warnIfFfmpegMissing();
|
|
|
|
|
|
|
|
|
|
if (!env.REDIS_URL) {
|
|
|
|
|
throw new Error('REDIS_URL is required to start a worker process.');
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-29 12:28:58 +01:00
|
|
|
void connectRedis();
|
|
|
|
|
|
2026-05-18 03:47:22 +01:00
|
|
|
log.info('worker-bootstrap', {
|
|
|
|
|
nodeEnv: env.NODE_ENV,
|
|
|
|
|
pid: process.pid,
|
|
|
|
|
hasOpenAi: Boolean(env.OPENAI_API_KEY)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
process.on('uncaughtException', (error) => {
|
|
|
|
|
log.error('uncaught-exception', { message: error.message, stack: error.stack });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
process.on('unhandledRejection', (reason) => {
|
|
|
|
|
log.error('unhandled-rejection', { reason: reason instanceof Error ? reason.message : String(reason) });
|
|
|
|
|
});
|