Skip to content

Commit 5c6733a

Browse files
const file
1 parent ed1178d commit 5c6733a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/consts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DEFAULT_POLL_VALUE = 60;

lib/webpagetest.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var http = require("http"),
1515
server = require("./server"),
1616
mapping = require("./mapping");
1717

18+
const { DEFAULT_POLL_VALUE } = require("./consts");
19+
1820
var reSpace = /\s/,
1921
reConnectivity =
2022
/^(?:Cable|DSL|3GSlow|3G|3GFast|4G|LTE|Edge|2G|Dial|FIOS|Native|custom)$/,
@@ -475,8 +477,7 @@ function runTest(what, options, callback) {
475477
// poll results
476478
if (options.pollResults && !options.dryRun) {
477479
// setting the lower limit to 20s
478-
options.pollResults = Math.max(20, options.pollResults) * 1000;
479-
options.pollResults = parseInt(options.pollResults, 10) || 60000;
480+
options.pollResults = Math.max(20, options.pollResults || DEFAULT_POLL_VALUE) * 1000;
480481

481482
return api.call(
482483
this,
@@ -539,7 +540,7 @@ function runTest(what, options, callback) {
539540
function runTestAndWait(what, options, callback) {
540541
delete options.pollResults;
541542

542-
options = Object.assign(options, { pollResults: 60 });
543+
options = Object.assign(options, { pollResults: DEFAULT_POLL_VALUE });
543544

544545
new Promise((resolve) => {
545546
let test = runTest.bind(this, what, options, callback);

0 commit comments

Comments
 (0)