Skip to content

Commit

Permalink
add timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
RPing committed Oct 21, 2017
1 parent a4e3494 commit 5bb26e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/sites/project/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Github {
}

getNewVersionInfo(check_date, project, cb) {
const req = request(`https://github.com/${project.project_author}/${project.project_name}/releases.atom`)
const url = `https://github.com/${project.project_author}/${project.project_name}/releases.atom`
const req = request(url, { timeout: 1500 })
const feedparser = new FeedParser({ addmeta: false })

const info = []
Expand Down
3 changes: 2 additions & 1 deletion lib/sites/project/pypi.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class Pypi {

getNewVersionInfo(check_date, project, cb) {
const info = []
const url = `https://pypi.python.org/pypi/${project.project_name}/json`

request(`https://pypi.python.org/pypi/${project.project_name}/json`, (error, response, body) => {
request(url, { timeout: 3000 }, (error, response, body) => {
if (error)
return cb(error)

Expand Down

0 comments on commit 5bb26e1

Please sign in to comment.