diff --git a/README.md b/README.md index 4ff221c6..5b34964c 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ It may be required to create the following index for faster sorting (see [#24](h ``` db.agendaJobs.ensureIndex({ + "repeatInterval": -1, "nextRunAt" : -1, "lastRunAt" : -1, "lastFinishedAt" : -1 diff --git a/lib/controllers/agendash.js b/lib/controllers/agendash.js index ef770e8a..8f35c1c0 100644 --- a/lib/controllers/agendash.js +++ b/lib/controllers/agendash.js @@ -9,8 +9,8 @@ module.exports = function (agenda, options) { const collection = agenda._collection.collection || agenda._collection; collection.createIndexes( [ - { key: { nextRunAt: -1, lastRunAt: -1, lastFinishedAt: -1 } }, - { key: { name: 1, nextRunAt: -1, lastRunAt: -1, lastFinishedAt: -1 } }, + { key: { repeatInterval: -1, nextRunAt: -1, lastRunAt: -1, lastFinishedAt: -1 } }, + { key: { name: 1, repeatInterval: -1, nextRunAt: -1, lastRunAt: -1, lastFinishedAt: -1 } }, ], (error) => { if (error) {