summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-11-14 20:26:29 +0300
committereug-vs <eug-vs@keemail.me>2020-11-14 20:26:29 +0300
commit61b16a068ac2bb4d8576d9a8aeb0f3f572587eed (patch)
tree5044f79434c7e0083d73b189f80fe88e33e688ef
parent33e640f1e8654fcfc8102b43449c79bcb4d5ddff (diff)
downloadbsu-fantom-61b16a068ac2bb4d8576d9a8aeb0f3f572587eed.tar.gz
chore: add logs to job events
-rw-r--r--src/handlers/index.js1
-rw-r--r--src/services/events/event.service.js6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/handlers/index.js b/src/handlers/index.js
index 18946fc..196c3db 100644
--- a/src/handlers/index.js
+++ b/src/handlers/index.js
@@ -35,7 +35,6 @@ const handleJobAsUser = async (job, user) => {
};
const handleJob = async job => {
- console.log('Running attend class job');
const { data } = job.attrs;
const participants = await UserModel.find({
diff --git a/src/services/events/event.service.js b/src/services/events/event.service.js
index accd45d..267016f 100644
--- a/src/services/events/event.service.js
+++ b/src/services/events/event.service.js
@@ -18,6 +18,12 @@ class Events {
// Define jobs
this.agenda.define('attend class', handleAttendClassJob);
+
+ // Logs
+ this.agenda.on('start', job => console.log(`Starting ${job.attrs.name} job`));
+ this.agenda.on('complete', job => console.log(`Job ${job.attrs.name} finished`));
+ this.agenda.on('fail', (job, err) => console.log(`Job failed with the error ${err}`));
+
return this.agenda.start();
};