mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 13:03:42 +01:00
debt - lift more environment properties to electron-main
This commit is contained in:
@@ -7,7 +7,6 @@ import { basename, dirname, join } from 'vs/base/common/path';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { readdir, rimraf, stat } from 'vs/base/node/pfs';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
||||
export class NodeCachedDataCleaner {
|
||||
@@ -19,7 +18,7 @@ export class NodeCachedDataCleaner {
|
||||
private readonly _disposables = new DisposableStore();
|
||||
|
||||
constructor(
|
||||
@INativeEnvironmentService private readonly _environmentService: INativeEnvironmentService
|
||||
private readonly nodeCachedDataDir: string | undefined
|
||||
) {
|
||||
this._manageCachedDataSoon();
|
||||
}
|
||||
@@ -32,14 +31,14 @@ export class NodeCachedDataCleaner {
|
||||
// Cached data is stored as user data and we run a cleanup task everytime
|
||||
// the editor starts. The strategy is to delete all files that are older than
|
||||
// 3 months (1 week respectively)
|
||||
if (!this._environmentService.nodeCachedDataDir) {
|
||||
if (!this.nodeCachedDataDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The folder which contains folders of cached data. Each of these folder is per
|
||||
// version
|
||||
const nodeCachedDataRootDir = dirname(this._environmentService.nodeCachedDataDir);
|
||||
const nodeCachedDataCurrent = basename(this._environmentService.nodeCachedDataDir);
|
||||
const nodeCachedDataRootDir = dirname(this.nodeCachedDataDir);
|
||||
const nodeCachedDataCurrent = basename(this.nodeCachedDataDir);
|
||||
|
||||
let handle: NodeJS.Timeout | undefined = setTimeout(() => {
|
||||
handle = undefined;
|
||||
|
||||
@@ -84,6 +84,7 @@ interface ISharedProcessInitData {
|
||||
sharedIPCHandle: string;
|
||||
args: NativeParsedArgs;
|
||||
logLevel: LogLevel;
|
||||
nodeCachedDataDir?: string;
|
||||
backupWorkspacesPath: string;
|
||||
}
|
||||
|
||||
@@ -261,7 +262,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
||||
(localizationsService as LocalizationsService).update();
|
||||
// cache clean ups
|
||||
disposables.add(combinedDisposable(
|
||||
instantiationService2.createInstance(NodeCachedDataCleaner),
|
||||
new NodeCachedDataCleaner(initData.nodeCachedDataDir),
|
||||
instantiationService2.createInstance(LanguagePackCachedDataCleaner),
|
||||
instantiationService2.createInstance(StorageDataCleaner, initData.backupWorkspacesPath),
|
||||
instantiationService2.createInstance(LogsDataCleaner),
|
||||
|
||||
Reference in New Issue
Block a user