Now SQL API is able to disable Batch Service using argv param --no-batch

This commit is contained in:
Daniel García Aubert 2016-01-08 18:29:36 +01:00
parent 8d29e6b45c
commit 078eb7706b
2 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ var CacheStatusController = require('./controllers/cache_status_controller');
var HealthCheckController = require('./controllers/health_check_controller'); var HealthCheckController = require('./controllers/health_check_controller');
var VersionController = require('./controllers/version_controller'); var VersionController = require('./controllers/version_controller');
var Batch = require('../batch'); var batch = require('../batch');
process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi'; process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi';
@ -180,9 +180,10 @@ function App() {
var versionController = new VersionController(); var versionController = new VersionController();
versionController.route(app); versionController.route(app);
if (global.settings.environment !== 'test') { var isBatchProcess = process.argv.indexOf('--no-batch') === -1;
var batch = new Batch(metadataBackend);
batch.start(); if (global.settings.environment !== 'test' && isBatchProcess) {
batch(metadataBackend).start();
} }
return app; return app;

View File

@ -1,7 +1,6 @@
var _ = require('underscore'); var _ = require('underscore');
var queue = require('queue-async'); var queue = require('queue-async');
var Batch = require('../../batch'); var batchFactory = require('../../batch');
// var Batch = require('../../batch/batch');
var JobPublisher = require('../../batch/job_publisher'); var JobPublisher = require('../../batch/job_publisher');
var JobQueue = require('../../batch/job_queue'); var JobQueue = require('../../batch/job_queue');
var UserIndexer = require('../../batch/user_indexer'); var UserIndexer = require('../../batch/user_indexer');
@ -22,7 +21,7 @@ describe('batch module', function() {
var userIndexer = new UserIndexer(metadataBackend); var userIndexer = new UserIndexer(metadataBackend);
var jobBackend = new JobBackend(metadataBackend, jobQueue, jobPublisher, userIndexer); var jobBackend = new JobBackend(metadataBackend, jobQueue, jobPublisher, userIndexer);
var batch = new Batch(metadataBackend); var batch = batchFactory(metadataBackend);
before(function () { before(function () {
batch.start(); batch.start();