Questions tagged [agenda]

Agenda is a light-weight job scheduling library for Node.js, with a Mongo persistence layer.

Agenda is a light-weight job scheduling library for Node.js.

It offers:

  • Minimal overhead. Agenda aims to keep its code base small.
  • Mongo backed persistance layer.
  • Promises based API
  • Scheduling with configurable priority, concurrency, and repeating
  • Scheduling via cron or human readable syntax.
  • Event backed job queue that you can hook into.
  • Optional standalone web-interfaces (see agendash and agenda-ui)

Installation

Install via NPM

npm install agenda

You will also need a working mongo database (2.6+) to point it to.

Example Usage

var mongoConnectionString = "mongodb://127.0.0.1/agenda";

var agenda = new Agenda({db: {address: mongoConnectionString}});

// or override the default collection name:
// var agenda = new Agenda({db: {address: mongoConnectionString, collection: "jobCollectionName"}});

// or pass additional connection options:
// var agenda = new Agenda({db: {address: mongoConnectionString, collection: "jobCollectionName", options: {server:{auto_reconnect:true}}}});

// or pass in an existing mongodb-native MongoClient instance
// var agenda = new Agenda({mongo: myMongoClient});

agenda.define('delete old users', function(job, done) {
  User.remove({lastLogIn: { $lt: twoDaysAgo }}, done);
});

agenda.on('ready', function() {
  agenda.every('3 minutes', 'delete old users');

  // Alternatively, you could also do:
  agenda.every('*/3 * * * *', 'delete old users');

  agenda.start();
});

More Info:

https://github.com/agenda/agenda

98 questions
2
votes
2 answers

UnhandledPromiseRejectionWarning when using agenda

I wrote some code by agenda package and I've got UnhandledPromiseRejectionWarning when I run my project. My code here: agenda.define('transferDBField', (job, done) => { if (this.tPrice) { this.prices.push(this.tPrice); done(); …
Ali
  • 69
  • 7
2
votes
0 answers

Is there a way to set a width to buffer when calling org-agenda-columns?

It would just be nice that the column agenda view would span the whole buffer width. Any ideas?
2
votes
2 answers

node js - how to modify an existing job in agenda

I am creating a back-end application using node js and mongoDb and in that i am using agenda for job scheduling. I have offerModel in my application to add, update or delete offers. So, for updating the expired offers according to their validity, i…
Vikas Valechha
  • 303
  • 1
  • 5
  • 12
2
votes
1 answer

Full Calendar columnFormat leads to object object

I'm trying to change the column titles in agendaWeek to show only the day, eg Mon, instead of Mon 5/7. However, when I try to make any change, the column title becomes object object.Here's a screenshot. I'm using version 3.4.0 of FullCalendar and…
dobolicious
  • 60
  • 2
  • 8
2
votes
2 answers

How do I run cron-like job at certain date time in the future using Agenda in Nodejs

I have a problem here. How do i run job at certain date time in the future using Agenda like node-scheduler do. Based on https://www.npmjs.com/package/node-schedule, node-schedule have cron-style scheduling method. So it is easier for me to extract…
digit
  • 4,479
  • 3
  • 24
  • 43
1
vote
0 answers

Multiple job schedules are missing using agenda

I have saved some schedules in the Mongo database. On service start, I get all the schedule details and pass them to the agenda. Currently, 100 jobs need to run 5 mins apart, but some entries are getting missed in the "agendaJobs" collection, and…
Developer
  • 63
  • 1
  • 3
1
vote
0 answers

Add event to selected day Calendar Agenda

I am currently learning to build an app with react native expo and javascript. I have my calendar displaying but I can't figure out how to add event to day selected. There will be a button that the user press and from this they should be able to add…
1
vote
0 answers

I'm trying to build System to see all seller weekly income. than nextweek paymentDate need to update but I fail

I'm trying to build an e-commerce app. I got a problem. I want every seller's weekly income. Every week payment data need to update automatically so I used agenda Js. But when my server is restarting I can't update data automatically. This is my…
maDan kD
  • 11
  • 1
1
vote
1 answer

How to test server code that relies on a database?

I have a NodeJS/MongoDB app. There are lots of functions, and I have a bunch of unit tests to test specifically logic of some functions. There is also code that uses Agenda (task scheduling library) which itself requires MongoDB for persistance. How…
Chaz Ashley
  • 389
  • 1
  • 15
1
vote
0 answers

Agenda jobs go to locked state and never run

I'm using Agenda for job processing. I'm facing an issue with the locking mechanism. I don't know how it works. If I define a job that is going to run at 12 AM then at 12 AM lockedAt updated with the current time and the job does not run. I'm using…
1
vote
0 answers

How to change colour of EACH item checkbox using Agenda from react-native-calendars

I'm creating a Medication Reminder & Calendar app using React Native and Expo. I am using the react-native-calendars library and implementing the 'Agenda' component to obtain the weekly calendar view as seen in the following screenshots. As seen…
1
vote
1 answer

Change colour on click - react-native

I am creating a medication reminder app for a university project and I'm using the Agenda tag from the react-native-calendars library. This is what my app looks like right now: 1 I would like to add a function that changes the colour of each item in…
1
vote
0 answers

How to stop the execution of a function inside agenda's job?

I have an agenda job, that every 1 day invokes stockSyncServices.startSync() function. I need to be able send request to my rest api endpoint, and stop executing the function startSync() in request handler. I tried invoke agenda.cancel() - but it's…
1
vote
0 answers

Disable logs in agenda npm

agenda.every("3 minutes", "delete old users"); await agenda.start(); I am setting up a job scheduler using Agenda.js and Node, backed with MongoDB. So far it's working as expected. However, I'm getting agenda logs in my console, so how to disable…
1
vote
1 answer

Agenda Cannot read property insertOne of undefined

I am trying to create and schedule jobs with agenda. So i split it into two files, one file the consumer creates jobs and the other file the producer schedules jobs. this is the consumer file const Agenda = require("agenda"); async function run() { …
Nathaniel Babalola
  • 617
  • 2
  • 6
  • 15