-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add a timeout to fetch()
+ configurable environment variable
#24
base: master
Are you sure you want to change the base?
Conversation
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.
thank you for working on this so much!!
Co-Authored-By: bnb <[email protected]>
LGTM @juliangruber! As a note, I used the all caps because of a similar environment variable in the GraphQL code 😅 |
oops! consistency :D |
// Setting up a timeout to be used with fetch() – will use the NCM_TIMEOUT environment | ||
// variable or default to 2 minutes (120 seconds / 120000 milliseconds) | ||
const timeout = process.env.NCM_TIMEOUT | ||
? Number(process.env.NCM_TIMEOUT) * 1000 |
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.
still need to check for a non-numeric string in the env var:
$ node -p 'Number("foo") * 1000'
NaN
timeout
will end up being a NaN
in that case
This PR adds a timeout to the
fetch()
call in/bin/ncm-ci.js
. Also adds theNCM_TIMEOUT
environment variable, which can be used to set a custom timeout time (2 minutes by default).