-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (25 loc) · 788 Bytes
/
app.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
const CLI = require('./cli/cli.js');
const Dispatch = require('./dispatch/dispatch.js');
const Metrics = require('./metrics/metrics.js');
const config = require('./config/config.js');
const event = require('./utils/event.js');
const sleep = require('./utils/sleep.js');
const cli = new CLI();
config.set(cli.options);
cli.start();
const metrics = new Metrics();
metrics.start();
const dispatch = new Dispatch(cli.options);
dispatch.start();
event.on('metrics:status', function(message) {
cli.displayMessage(metrics.statusString());
})
event.on('cli:stop', function() {
dispatch.stop();
metrics.stop();
cli.stop();
cli.displayMessage("Stopping with 10 second delay for server response...");
sleep(10).then(value => {
cli.displayMessage(metrics.toString());
});
});