Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 6c44b1a

Browse files
authored
Merge pull request #19 from Jfelix61/types/agenda
Added agenda typescript implementation
2 parents d74da95 + cd6b13c commit 6c44b1a

File tree

5 files changed

+5148
-4
lines changed

5 files changed

+5148
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"winston": "^3.2.1"
5555
},
5656
"devDependencies": {
57+
"@types/agenda": "^2.0.4",
5758
"@types/express": "^4.16.0",
5859
"@types/jest": "^23.3.8",
5960
"@types/lodash": "^4.14.118",

src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default {
3939
agenda: {
4040
dbCollection: process.env.AGENDA_DB_COLLECTION,
4141
pooltime: process.env.AGENDA_POOL_TIME,
42-
concurrency: process.env.AGENDA_CONCURRENCY,
42+
concurrency: parseInt(process.env.AGENDA_CONCURRENCY, 10),
4343
},
4444

4545
/**

src/loaders/agenda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import config from '../config';
44
export default ({ mongoConnection }) => {
55
return new Agenda({
66
mongo: mongoConnection,
7-
collection: config.agenda.dbCollection,
7+
db: { collection: config.agenda.dbCollection },
88
processEvery: config.agenda.pooltime,
99
maxConcurrency: config.agenda.concurrency,
10-
}) as any;
10+
});
1111
/**
1212
* This voodoo magic is proper from agenda.js so I'm not gonna explain too much here.
1313
* https://github.com/agenda/agenda#mongomongoclientinstance

src/loaders/jobs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import config from '../config';
22
import EmailSequenceJob from '../jobs/emailSequence';
3+
import Agenda from 'agenda';
34

4-
export default ({ agenda }) => {
5+
export default ({ agenda }: { agenda: Agenda }) => {
56
agenda.define(
67
'send-email',
78
{ priority: 'high', concurrency: config.agenda.concurrency },

0 commit comments

Comments
 (0)