I'm using agenda.schedule to planify jobs and within a transaction. The problem is that schedule accept only 3 params and it make a save to the collection, but I cannot pass the session within
const agenda = new Agenda({
db: { address: settings.mongodb.url, collection: 'agendaJobs' },
});
const session = client.startSession();
await session.withTransaction(async () => { ....
export function schedule<T extends JobAttributesData>(this: Agenda, when: string | Date, names: string, data: T): Promise<Job>;
So here,i cannot pass a session to schedule to apply my transaction (it makes a save to agendaJobs even the transaction fail)
Is there a solution for that?
I'm trying to apply a transaction to schedule (where it saves to agendaJobs)