Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
blastastic-cicd
/
blastastic-backend
/
production
/
current
/
src
/
Filename :
agenda.ts
back
Copy
import Agenda from 'agenda'; // Initialize Agenda with MongoDB connection and wait until it's ready const initializeAgenda = async () => { const agenda = new Agenda({ db: { address: process.env.MONGO_URI! } }); return new Promise((resolve, reject) => { // Set up event listeners for 'ready' and 'error' events agenda.on('ready', () => { console.log('agenda started'); resolve(agenda); // Return the agenda instance when it's ready }); agenda.on('error', (error) => { reject(error); }); // Start processing agenda jobs agenda.start(); }); }; // Export the initialized agenda instance const getAgendaInstance = async () => { // Wait for agenda initialization and return the instance const agenda = await initializeAgenda(); return agenda; }; // Exporting the function to get the agenda instance export default getAgendaInstance;