Skip to content

Commit e6e2449

Browse files
committed
Added queueSize option to init pool - see #136
1 parent cdfc01a commit e6e2449

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Master
2+
* Added `queueSize` option to `initPool` to set the request overfow queue size
3+
14
# 2.0.14
25

36
* Fixed issue with CDN pull failing when using Highcharts < 6.0

lib/phantompool.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ function init(config) {
295295
config = config || {};
296296

297297
settings = {
298+
queueSize: config.queueSize || 5,
298299
timeoutThreshold: 3500,
299300
maxWorkers: config.maxWorkers || 8,
300301
initialWorkers: config.initialWorkers || config.maxWorkers || 8,
@@ -376,7 +377,7 @@ function postWork(data, fn) {
376377
});
377378

378379
if (!foundWorker) {
379-
if (workQueue.length > 5) {
380+
if (workQueue.length > settings.queueSize) {
380381
queueOverflow++;
381382
log(2, 'phantom - queue is full, dropping request');
382383
return fn && fn('server too busy, please try again later');

0 commit comments

Comments
 (0)