-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: PFG-3233. Increasing minimum timeout to be not less than 1500 ms. #192
fix: PFG-3233. Increasing minimum timeout to be not less than 1500 ms. #192
Conversation
src/ajax.js
Outdated
@@ -67,7 +67,9 @@ export function fetcherFactory(timeout = 3000, {request, done} = {}) { | |||
let fetcher = (resource, options) => { | |||
let to; | |||
if (timeout != null && options?.signal == null && !config.getConfig('disableAjaxTimeout')) { | |||
to = dep.timeout(timeout, resource); | |||
const minTimout = 1500; | |||
const normalizedTimeout = timeout > minTimout ? timeout : minTimout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we can simplify that:
const normalizedTimeout = timeout > minTimout ? timeout : minTimout; | |
const normalizedTimeout = Math.max(timeout, minTimout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanx, that's a good option.
For me looks if I simplify it this way, then it would add the need to leave a comment to explain why we using Math.max to filter out too little timeout.
I would say original line looks more self explanatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately this shouldn't be be in Prebid... its fine for testing purposes but this would need to be moved to pubfig if it has some results...
Type of change
Bugfix
Feature
New bidder adapter
Updated bidder adapter
Code style update (formatting, local variables)
Refactoring (no functional changes, no api changes)
Build related changes
CI related changes
Does this change affect user-facing APIs or examples documented on http://prebid.org?
Other
Description of change
Other information