Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/consts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const DEFAULT_POLL_VALUE = 60;
export const POLL_LOWER_LIMIT = 20;
6 changes: 4 additions & 2 deletions lib/webpagetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var http = require("http"),
server = require("./server"),
mapping = require("./mapping");

const { DEFAULT_POLL_VALUE, POLL_LOWER_LIMIT} = require("./consts");

var reSpace = /\s/,
reConnectivity =
/^(?:Cable|DSL|3GSlow|3G|3GFast|4G|LTE|Edge|2G|Dial|FIOS|Native|custom)$/,
Expand Down Expand Up @@ -474,7 +476,7 @@ function runTest(what, options, callback) {

// poll results
if (options.pollResults && !options.dryRun) {
options.pollResults = parseInt(options.pollResults * 1000, 10) || 5000;
options.pollResults = Math.max(POLL_LOWER_LIMIT, options.pollResults || DEFAULT_POLL_VALUE) * 1000;

return api.call(
this,
Expand Down Expand Up @@ -537,7 +539,7 @@ function runTest(what, options, callback) {
function runTestAndWait(what, options, callback) {
delete options.pollResults;

options = Object.assign(options, { pollResults: 13 });
options = Object.assign(options, { pollResults: DEFAULT_POLL_VALUE });

new Promise((resolve) => {
let test = runTest.bind(this, what, options, callback);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpagetest",
"version": "0.7.5",
"version": "0.7.6",
"description": "WebPageTest API wrapper for NodeJS",
"author": "WebPageTest <github@WebPageTest.com> (http://github.com/WebPageTest)",
"homepage": "http://github.com/WebPageTest/webpagetest-api",
Expand Down