File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -240,18 +240,12 @@ export class ElectronVersions extends BaseVersions {
240
240
return new ElectronVersions ( versionsCache , now , versions ) ;
241
241
}
242
242
243
- // upate the cache if it's too old
244
- private async keepFresh ( ) : Promise < void > {
245
- const d = debug ( 'fiddle-core:ElectronVersions:keepFresh' ) ;
246
-
247
- // if it's still fresh, do nothing
243
+ // update the cache
244
+ public async fetch ( ) : Promise < void > {
245
+ const d = debug ( 'fiddle-core:ElectronVersions:fetch' ) ;
248
246
const { mtimeMs, versionsCache } = this ;
249
- const now = Date . now ( ) ;
250
- if ( ElectronVersions . isCacheFresh ( mtimeMs , now ) ) return ;
251
-
252
- // update the cache
253
247
try {
254
- this . mtimeMs = now ;
248
+ this . mtimeMs = Date . now ( ) ;
255
249
const versions = await ElectronVersions . fetchVersions ( versionsCache ) ;
256
250
this . setVersions ( versions ) ;
257
251
d ( `saved "${ versionsCache } "` ) ;
@@ -261,6 +255,13 @@ export class ElectronVersions extends BaseVersions {
261
255
}
262
256
}
263
257
258
+ // upate the cache iff it's too old
259
+ private async keepFresh ( ) : Promise < void > {
260
+ if ( ! ElectronVersions . isCacheFresh ( this . mtimeMs , Date . now ( ) ) ) {
261
+ await this . fetch ( ) ;
262
+ }
263
+ }
264
+
264
265
public override get prereleaseMajors ( ) : number [ ] {
265
266
void this . keepFresh ( ) ;
266
267
return super . prereleaseMajors ;
You can’t perform that action at this time.
0 commit comments