Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / workers / index.js
blob44f19c236af89db49c821fc0d3a47ea5f0c739c5
1 'use strict';
3 var onMongoConnect = require('gitter-web-persistence-utils/lib/on-mongo-connect');
4 var debug = require('debug')('gitter:infra:workers');
6 var listening = false;
8 exports.listen = function() {
9   if (listening) return;
10   listening = true;
12   debug('Starting scheduler instance');
13   require('gitter-web-utils/lib/worker-queue-redis').startScheduler();
15   // Do not start the workers until theres a valid mongo connection
16   // A redis connection is implied since resque needs redis to process
17   // the workers
18   onMongoConnect().then(function() {
19     debug('Starting works on successful mongodb connection');
20     require('gitter-web-unread-items/lib/readby-service').listen();
21     require('gitter-web-unread-items').listen();
22     require('../services/notifications/push-notification-postbox').listen();
23   });