2018-06-02 15:50:39 +00:00
|
|
|
import co from 'co';
|
|
|
|
import kue from 'kue';
|
2019-01-14 21:37:03 +00:00
|
|
|
import Sentry from '@sentry/node';
|
2018-06-02 15:50:39 +00:00
|
|
|
import debuglog from 'debug';
|
|
|
|
|
|
|
|
const debug = debuglog('hostr:worker');
|
|
|
|
|
2019-01-14 21:37:03 +00:00
|
|
|
Sentry.config(process.env.SENTRY_DSN).install();
|
2018-06-02 15:50:39 +00:00
|
|
|
|
|
|
|
const queue = kue.createQueue({
|
|
|
|
redis: process.env.REDIS_URL,
|
|
|
|
});
|
|
|
|
|
|
|
|
function store(data, done) {
|
|
|
|
co(function* gen() { // eslint-disable-line no-loop-func
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
debug(err);
|
2019-01-14 21:37:03 +00:00
|
|
|
Sentry.captureException(err);
|
2018-06-02 15:50:39 +00:00
|
|
|
return done();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
queue.process('store', 5, (job, done) => {
|
|
|
|
store(job.data, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
kue.app.listen(3000);
|