File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -183,15 +183,15 @@ export class BaseVersions implements Versions {
183
183
}
184
184
}
185
185
186
+ const VERSION_CACHE_TTL_MS = 4 * 60 * 60 * 1000 ; // cache for N hours
187
+
186
188
/**
187
189
* Implementation of Versions that self-populates from release information at
188
190
* https://releases.electronjs.org/releases.json .
189
191
*
190
192
* This is generally what to use in production.
191
193
*/
192
194
export class ElectronVersions extends BaseVersions {
193
- private static readonly freshnessMs = 4 * 60 * 60 * 1000 ; // cache for N hours
194
-
195
195
private constructor (
196
196
private readonly versionsCache : string ,
197
197
private mtimeMs : number ,
@@ -220,7 +220,7 @@ export class ElectronVersions extends BaseVersions {
220
220
const now = Date . now ( ) ;
221
221
try {
222
222
const st = await fs . stat ( versionsCache ) ;
223
- if ( now <= st . mtimeMs + ElectronVersions . freshnessMs )
223
+ if ( now <= st . mtimeMs + VERSION_CACHE_TTL_MS )
224
224
versions = ( await fs . readJson ( versionsCache ) ) as unknown ;
225
225
} catch ( err ) {
226
226
// cache file missing
@@ -244,7 +244,7 @@ export class ElectronVersions extends BaseVersions {
244
244
// if it's still fresh, do nothing
245
245
const { mtimeMs, versionsCache } = this ;
246
246
const now = Date . now ( ) ;
247
- if ( now <= mtimeMs + ElectronVersions . freshnessMs ) return ;
247
+ if ( now <= mtimeMs + VERSION_CACHE_TTL_MS ) return ;
248
248
249
249
// update the cache
250
250
try {
You can’t perform that action at this time.
0 commit comments