Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !10298

Added a timeout to checkForLastestVersion

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/llshicc/master into main Dec 26, 2020
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: llshicc

The default registry of NPM can not be got quickly in some areas, and the developers have to set local registries to optimize, so using GET to send a request to npm to check the last version become very slow, even block the whole progress.

In this case, npm view create-react-app version is fine while https.get('https://registry.npmjs.org/-/package/create-react-app/dist-tags', ....) blocks the progress, as the promise would never be solved or rejected if it didn't get a response.

I added a 5s timeout to make it continue to work if can't checkForLastestVersion get the response after the timeout. The 5s waiting time is acceptable for me, it also can be other values. The main purpose is that the checkForLastestVersion not block the progress if it cannot get a response from npm default registry.

I'd be glad and appreciate it if you could consider this pull request!

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/llshicc/master