Skip to content

Commit

Permalink
fix(cache): change timestamp to 1 hour instead of 10 hours (#223)
Browse files Browse the repository at this point in the history
closes #221
  • Loading branch information
cnishina authored Mar 13, 2017
1 parent e17f6bd commit 5af1c1c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/binaries/config_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export abstract class XmlConfigSource extends ConfigSource {
let timestamp = new Date(fs.statSync(fileName).mtime).getTime();

let now = Date.now();
if (now - 36000000 < timestamp) {
// 60 minutes * 60 seconds / minute * 1000 ms / second
if (now - (60 * 60 * 1000) < timestamp) {
return this.convertXml2js(contents);
}
} catch (err) {
Expand Down Expand Up @@ -172,7 +173,8 @@ export abstract class GithubApiConfigSource extends JsonConfigSource {
let timestamp = new Date(fs.statSync(fileName).mtime).getTime();

let now = Date.now();
if (now - 36000000 < timestamp) {
// 60 minutes * 60 seconds / minute * 1000 ms / second
if (now - (60 * 60 * 1000) < timestamp) {
return contents;
}
} catch (err) {
Expand Down

2 comments on commit 5af1c1c

@nickcmaynard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good ;-)

@cnishina
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I can math!

Please sign in to comment.