-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Clean up some helpers #1117
Clean up some helpers #1117
Changes from 4 commits
86791b4
92ef9ee
ba94c59
e449e1c
dbc72ae
7afb99e
0e54c63
b27f2f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
'use strict'; | ||
|
||
function isSnapshotVersion(version) { | ||
const pattern = /(\d+\.)*\d\-SNAPSHOT/; | ||
if (version) { | ||
return version.match(pattern); | ||
} else { | ||
return false; | ||
} | ||
const pattern = /(\d+\.)*\d-SNAPSHOT/; | ||
return version && version.match(pattern); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. |
||
} | ||
|
||
module.exports = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ const request = require('request'); | |
|
||
// Map from URL to { timestamp: last fetch time, interval: in milliseconds, | ||
// data: data }. | ||
let regularUpdateCache = Object.create(null); | ||
let regularUpdateCache = new Map(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have no unit test or service test coverage on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to reset these changes. |
||
|
||
// url: a string, scraper: a function that takes string data at that URL. | ||
// interval: number in milliseconds. | ||
|
@@ -33,7 +33,7 @@ function regularUpdate(url, interval, scraper, cb) { | |
} | ||
|
||
function clearRegularUpdateCache() { | ||
regularUpdateCache = Object.create(null); | ||
regularUpdateCache = new Map(); | ||
} | ||
|
||
module.exports = { | ||
|
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.
Could do
return reject(new Error('Posting the GitHub user token failed: ' + err.message))
or something similar. Up to you.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.
Yea… I thought about that. This is called in a loop, and the calling code already has something really similar to that. It feels redundant to prefix it twice.