summaryrefslogtreecommitdiff
path: root/src/handlers/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers/index.js')
-rw-r--r--src/handlers/index.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/handlers/index.js b/src/handlers/index.js
index 09cd726..2234b05 100644
--- a/src/handlers/index.js
+++ b/src/handlers/index.js
@@ -12,12 +12,12 @@ const { EDUFPMI_URL, NODE_ENV, HEADFUL } = process.env;
const headless = NODE_ENV === 'production' || !HEADFUL;
-const handleJobAsUser = async (job, browser, user) => {
- console.log(`Running job as ${user.username}`);
+const handleEventAsUser = async (event, browser, user) => {
+ console.log(`Running event as ${user.username}`);
const browserContext = await browser.createIncognitoBrowserContext();
- const { conferenceId } = job.attrs.data;
+ const { conferenceId } = event;
const conferenceUrl = `${EDUFPMI_URL}/mod/bigbluebuttonbn/view.php?id=${conferenceId}`;
const page = await launchUserSession(user, browserContext);
@@ -37,12 +37,10 @@ const handleJobAsUser = async (job, browser, user) => {
await browserContext.close();
};
-const handleJob = async job => {
- const { data } = job.attrs;
-
+const handleEvent = async event => {
const participants = await UserModel.find({
username: {
- $in: data.participants
+ $in: event.participants
}
});
@@ -51,12 +49,12 @@ const handleJob = async job => {
const browser = await puppeteer.launch({ headless, args: ['--no-sandbox', '--incognito'] });
try {
- await Bluebird.map(participants, participant => handleJobAsUser(job, browser, participant));
+ await Bluebird.map(participants, participant => handleEventAsUser(event, browser, participant));
} finally {
await browser.close();
}
};
-module.exports = handleJob;
+module.exports = handleEvent;