cleanup: removed reddit from this app
parent
5b97b4b219
commit
67615fc839
19
src/index.ts
19
src/index.ts
|
@ -3,7 +3,6 @@ dotenv.config();
|
|||
|
||||
import WorkflowOrchestrator from './workflows/WorkflowOrchestrator';
|
||||
import rDramaSession from './rdrama/session/SessionManager';
|
||||
import redditSession from './reddit/session/SessionManager';
|
||||
import { DatabaseInitializer } from './db/initializeDatabase';
|
||||
import RedisSessionManager from './redis/session/SessionManager';
|
||||
import { Comment } from './rdrama/models/Comment';
|
||||
|
@ -33,9 +32,6 @@ async function startApplication() {
|
|||
console.log(`Subscribed to ${'newCommentsChannel'}. Listening for new comments.`);
|
||||
});
|
||||
|
||||
console.log('Reddit Session Start')
|
||||
const redditSessionManager = await redditSession.getInstance()
|
||||
|
||||
const workflowOrchestrator = new WorkflowOrchestrator();
|
||||
|
||||
redisManager.client.on('message', async (channel, message) => {
|
||||
|
@ -46,37 +42,36 @@ async function startApplication() {
|
|||
}
|
||||
});
|
||||
|
||||
setupProcessListeners(redisManager, redditSessionManager, rDramaSessionManager);
|
||||
setupProcessListeners(redisManager, rDramaSessionManager);
|
||||
}
|
||||
|
||||
|
||||
function setupProcessListeners(redisManager: RedisSessionManager, redditSessionManager: redditSession, rDramaSessionManager: rDramaSession) {
|
||||
function setupProcessListeners(redisManager: RedisSessionManager, rDramaSessionManager: rDramaSession) {
|
||||
process.on('SIGINT', async () => {
|
||||
console.log('SIGINT received. Shutting down gracefully...');
|
||||
await shutdownServices(redisManager, redditSessionManager, rDramaSessionManager);
|
||||
await shutdownServices(redisManager, rDramaSessionManager);
|
||||
});
|
||||
|
||||
process.on('SIGTERM', async () => {
|
||||
console.log('SIGTERM received. Shutting down gracefully...');
|
||||
await shutdownServices(redisManager, redditSessionManager, rDramaSessionManager);
|
||||
await shutdownServices(redisManager, rDramaSessionManager);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', async (error) => {
|
||||
console.error('Uncaught Exception:', error);
|
||||
await shutdownServices(redisManager, redditSessionManager, rDramaSessionManager);
|
||||
await shutdownServices(redisManager, rDramaSessionManager);
|
||||
process.exit(1); // Exit with error
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', async (reason, promise) => {
|
||||
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
||||
await shutdownServices(redisManager, redditSessionManager, rDramaSessionManager);
|
||||
await shutdownServices(redisManager, rDramaSessionManager);
|
||||
process.exit(1); // Exit with error
|
||||
});
|
||||
}
|
||||
|
||||
async function shutdownServices(redisManager: RedisSessionManager, redditSessionManager: redditSession, rDramaSessionManager: rDramaSession) {
|
||||
async function shutdownServices(redisManager: RedisSessionManager, rDramaSessionManager: rDramaSession) {
|
||||
await redisManager.shutdown();
|
||||
await redditSessionManager.shutdown();
|
||||
await rDramaSessionManager.shutdown();
|
||||
console.log('Services shut down successfully.');
|
||||
process.exit(0); // Exit cleanly
|
||||
|
|
Loading…
Reference in New Issue