2018-04-04 10:07:07 -06:00
|
|
|
import deliver from './deliver';
|
2018-04-02 03:36:47 -06:00
|
|
|
import processInbox from './process-inbox';
|
2018-03-31 04:55:00 -06:00
|
|
|
import reportGitHubFailure from './report-github-failure';
|
|
|
|
|
|
|
|
const handlers = {
|
2018-04-05 03:43:06 -06:00
|
|
|
deliver,
|
|
|
|
processInbox,
|
|
|
|
reportGitHubFailure
|
2018-03-31 04:55:00 -06:00
|
|
|
};
|
|
|
|
|
2018-04-05 03:43:06 -06:00
|
|
|
export default (job, done) => {
|
|
|
|
const handler = handlers[job.data.type];
|
|
|
|
|
|
|
|
if (handler) {
|
2018-04-05 12:42:55 -06:00
|
|
|
handler(job, done);
|
2018-04-05 03:43:06 -06:00
|
|
|
} else {
|
|
|
|
console.warn(`Unknown job: ${job.data.type}`);
|
2018-04-05 12:42:55 -06:00
|
|
|
done();
|
2018-04-05 03:43:06 -06:00
|
|
|
}
|
|
|
|
};
|