1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const os_1 = require("os");
|
4 | const build_1 = require("./build");
|
5 | const nconf = require.main.require('nconf');
|
6 | const winston = require.main.require('winston');
|
7 | const pubsub = require.main.require('./src/pubsub');
|
8 | const primary = nconf.get('isPrimary') === 'true' || nconf.get('isPrimary') === true;
|
9 | function build(callback) {
|
10 | if (pubsub.pubClient) {
|
11 | pubsub.publish('emoji:build', {
|
12 | hostname: os_1.hostname(),
|
13 | });
|
14 | }
|
15 | if (primary) {
|
16 | build_1.default(callback);
|
17 | }
|
18 | else {
|
19 | callback();
|
20 | }
|
21 | }
|
22 | exports.build = build;
|
23 | const logErrors = (err) => {
|
24 | if (err) {
|
25 | winston.error(err);
|
26 | }
|
27 | };
|
28 | if (primary) {
|
29 | pubsub.on('emoji:build', (data) => {
|
30 | if (data.hostname !== os_1.hostname()) {
|
31 | build_1.default(logErrors);
|
32 | }
|
33 | });
|
34 | }
|
35 |
|
\ | No newline at end of file |