Skip to content

Commit

Permalink
disable agency again, add flag
Browse files Browse the repository at this point in the history
  • Loading branch information
martindale committed Feb 12, 2015
1 parent 7f8a26a commit f7e053c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
14 changes: 8 additions & 6 deletions controllers/artists.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,14 @@ module.exports = {
});
});

req.app.agency.publish('artist:update', {
id: artist._id
, timeout: 3 * 60 * 1000
}, function(err, job) {
console.log('update artist completed');
});
if (req.app.config.jobs && req.app.config.jobs.enabled) {
req.app.agency.publish('artist:update', {
id: artist._id
, timeout: 3 * 60 * 1000
}, function(err, job) {
console.log('update artist completed');
});
}

});
});
Expand Down
14 changes: 8 additions & 6 deletions controllers/people.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ module.exports = {
, tracks: (results[3]) ? results[3].tracks : null
});

req.app.agency.publish('artist:update', {
id: (results[3]) ? results[3].artist._id : null
, timeout: 3 * 60 * 1000
}, function(err, job) {
console.log('update artist completed');
});
if (req.app.config.jobs && req.app.config.jobs.enabled) {
req.app.agency.publish('artist:update', {
id: (results[3]) ? results[3].artist._id : null
, timeout: 3 * 60 * 1000
}, function(err, job) {
console.log('update artist completed');
});
}

});

Expand Down
12 changes: 7 additions & 5 deletions soundtrack.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var heapdump = require('heapdump');

// config, general requirements
var config = require('./config');
var config = require('./config'); config.jobs = { enabled: false };
var database = require('./db');
var util = require('./util');
var express = require('express');
Expand Down Expand Up @@ -37,10 +37,12 @@ var marked = require('marked');
var validator = require('validator');

// job queuing mechanism
var Agency = require('mongoose-agency');
app.agency = new Agency( database.source , {
// timeout: 0.01
});
if (config.jobs && config.jobs.enabled) {
var Agency = require('mongoose-agency');
app.agency = new Agency( database.source , {
// timeout: 0.01
});
}

app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
Expand Down

0 comments on commit f7e053c

Please sign in to comment.