Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB connections are getting increased gradually #1553

Open
sandipp opened this issue Aug 23, 2023 · 0 comments
Open

MongoDB connections are getting increased gradually #1553

sandipp opened this issue Aug 23, 2023 · 0 comments

Comments

@sandipp
Copy link

sandipp commented Aug 23, 2023

I have set up the agenda in production using the following code:

global.agenda = new Agenda({
    db: {
        address: process.env.MONGO_URL,
        options: { useNewUrlParser: true },
        collection: MONGO_COL_AGENDA
    },
    processEvery: "10 minutes",
    useUnifiedTopology: true
});

async function defineAgenda(schedule_id, scheduler_params, scheduler_name) {
    agenda.define(schedule_id, async (job) => {
        codeRunnerHelper.executor(scheduler_params, scheduler_name, true);
    });
}

await agenda.start();
const agendaSchedule = agenda.create(schedule_id);
var cron = codeRunnerHelper.calculate_recurrence(data);
defineAgenda(schedule_id, scheduler_params, scheduler_name);
await agendaSchedule
    .repeatEvery(`${cron}`, {
        timezone: scheduler_params[scheduler_name]["timezone"]
    })
    .save();
    
    ```
We are experiencing a gradual increase in the number of MongoDB connections, even with relatively low usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant