From 25786c32575f8e1dd6b2b294e20140cc9e15de5d Mon Sep 17 00:00:00 2001 From: Hugo Xu Date: Wed, 16 May 2018 09:01:40 -0600 Subject: [PATCH] Round hour up to nearest day (#3723) * Update storage.js * Update storage.js --- src/js/storage.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/storage.js b/src/js/storage.js index 627d6a7e9..78ddeb575 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -765,9 +765,12 @@ } } // Extract update frequency information - matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Expires:[\t ]*(\d+)[\t ]*day/i); + matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Expires:[\t ]*(\d+)[\t ]*(day|hour)/i); if ( matches !== null ) { v = Math.max(parseInt(matches[1], 10), 1); + if ( matches[2].toLowerCase() === 'hour' ) { + v = Math.ceil(v / 24); + } if ( v !== listEntry.updateAfter ) { this.assets.registerAssetSource(assetKey, { updateAfter: v }); }