提交 2a14a2c1 编写于 作者: J Johannes Rieken

delete cached data for insiders sooner, #29960

上级 969ffcb9
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册