From 2a14a2c111b6142817b34ea821b284c2a996b5cf Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 12 Jul 2017 16:41:24 +0200 Subject: [PATCH] delete cached data for insiders sooner, #29960 --- .../workbench/electron-browser/nodeCachedDataManager.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/electron-browser/nodeCachedDataManager.ts b/src/vs/workbench/electron-browser/nodeCachedDataManager.ts index 6867f109c80..52d57348df6 100644 --- a/src/vs/workbench/electron-browser/nodeCachedDataManager.ts +++ b/src/vs/workbench/electron-browser/nodeCachedDataManager.ts @@ -11,12 +11,17 @@ import { join, basename } from 'path'; import { readdir, rimraf, stat } from 'vs/base/node/pfs'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import product from 'vs/platform/node/product'; declare type OnNodeCachedDataArgs = [{ errorCode: string, path: string, detail?: string }, { path: string, length: number }]; declare const MonacoEnvironment: { onNodeCachedData: OnNodeCachedDataArgs[] }; export class NodeCachedDataManager { + private static _DataMaxAge = product.nameLong.indexOf('Insiders') >= 0 + ? 1000 * 60 * 60 * 24 * 7 // roughly 1 week + : 1000 * 60 * 60 * 24 * 30 * 3; // roughly 3 months + private _telemetryService: ITelemetryService; private _environmentService: IEnvironmentService; private _disposables: IDisposable[] = []; @@ -81,13 +86,11 @@ export class NodeCachedDataManager { readdir(nodeCachedDataDir).then(entries => { const now = Date.now(); - const limit = 1000 * 60 * 60 * 24 * 30 * 3; // roughly 3 months - const deletes = entries.map(entry => { const path = join(nodeCachedDataDir, entry); return stat(path).then(stats => { const diff = now - stats.mtime.getTime(); - if (diff > limit) { + if (diff > NodeCachedDataManager._DataMaxAge) { return rimraf(path); } return undefined; -- GitLab