-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·36 lines (30 loc) · 1.03 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const config = require('./lib/utils/config');
config.loadConfig().then(function () {
/* eslint-disable global-require */
const consts = require('./lib/consts');
const frontend = require('./lib/frontend');
const log = require('./lib/utils/logger');
const polling = require('./lib/utils/polling');
const streaming = require('./lib/utils/streaming');
const agenda = require('./lib/agenda');
/* eslint-enable global-require */
agenda.on('ready', function () {
consts.streaming.topics.forEach(function (topic) {
var data = {
topic: topic
};
agenda.now(streaming.getJobName(topic), data);
});
consts.polling.types.forEach(function (type) {
var data = {
type: type
};
agenda.every('30 minutes', polling.getJobName(type), data);
});
}).on('error', function (err) {
log.error(err);
});
frontend.start();
}).catch(function (error) {
console.error(error);
});