Default to 64 queued jobs as max

This commit is contained in:
Raul Ochoa 2016-10-17 15:23:53 +02:00
parent 4203696e1e
commit 66d1c18941
7 changed files with 13 additions and 7 deletions

View File

@ -7,6 +7,8 @@ Enhancements:
New features:
* Batch queries use per user-queues.
* Batch queries queues can limit the number of queued jobs per user.
- Default is 64 jobs.
- Configuration key `batch_max_queued_jobs` allows to modify the limit.
1.38.2 - 2016-10-13

View File

@ -7,7 +7,7 @@ var JobStatus = require('./job_status');
function JobBackend(metadataBackend, jobQueue) {
this.metadataBackend = metadataBackend;
this.jobQueue = jobQueue;
this.maxNumberOfQueuedJobs = global.settings.batch_max_queued_jobs || 250;
this.maxNumberOfQueuedJobs = global.settings.batch_max_queued_jobs || 64;
this.inSecondsJobTTLAfterFinished = global.settings.finished_jobs_ttl_in_seconds || 2 * 3600; // 2 hours
}
@ -98,7 +98,10 @@ JobBackend.prototype.create = function (job, callback) {
}
if (size >= self.maxNumberOfQueuedJobs) {
return callback(new Error('Failed to create job, max number of jobs queued reached'));
return callback(new Error(
'Failed to create job. ' +
'Max number of jobs (' + self.maxNumberOfQueuedJobs + ') queued reached'
));
}
self.get(job.job_id, function (err) {

View File

@ -33,7 +33,7 @@ module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout = 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max number of queued jobs a user can have at a given time
module.exports.batch_max_queued_jobs = 100;
module.exports.batch_max_queued_jobs = 64;
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses

View File

@ -34,7 +34,7 @@ module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout = 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max number of queued jobs a user can have at a given time
module.exports.batch_max_queued_jobs = 100;
module.exports.batch_max_queued_jobs = 64;
// Max database connections in the pool
// Subsequent connections will wait for a free slot.i
// NOTE: not used by OGR-mediated accesses

View File

@ -34,7 +34,7 @@ module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout = 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max number of queued jobs a user can have at a given time
module.exports.batch_max_queued_jobs = 100;
module.exports.batch_max_queued_jobs = 64;
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses

View File

@ -31,7 +31,7 @@ module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout = 5 * 1000; // 5 seconds in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max number of queued jobs a user can have at a given time
module.exports.batch_max_queued_jobs = 100;
module.exports.batch_max_queued_jobs = 64;
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses

View File

@ -71,7 +71,8 @@ describe('max queued jobs', function() {
createJob(self.server, 400, function(err, res) {
assert.ok(!err);
assert.equal(res.error[0], "Failed to create job, max number of jobs queued reached");
assert.equal(res.error[0], "Failed to create job. Max number of jobs (" +
global.settings.batch_max_queued_jobs + ") queued reached");
done();
});
});