Rename and add comment

This commit is contained in:
Andrew Eisenberg
2022-02-14 10:54:17 -08:00
parent ad5c43c9ba
commit cca65e5a48
4 changed files with 10 additions and 4 deletions

View File

@@ -439,6 +439,7 @@ async function activateWithInstalledDistribution(
const queryStorageDir = path.join(ctx.globalStorageUri.fsPath, 'queries');
await fs.ensureDir(queryStorageDir);
void logger.log('Initializing query history.');
const qhm = new QueryHistoryManager(
qs,
dbm,

View File

@@ -35,7 +35,7 @@ export function registerQueryHistoryScubber(
// optional counter to keep track of how many times the scrubber has run
counter?: Counter
): Disposable {
const deregister = setInterval(scrubber, wakeInterval, throttleTime, maxQueryTime, queryDirectory, ctx, counter);
const deregister = setInterval(scrubQueries, wakeInterval, throttleTime, maxQueryTime, queryDirectory, ctx, counter);
return {
dispose: () => {
@@ -44,7 +44,7 @@ export function registerQueryHistoryScubber(
};
}
async function scrubber(
async function scrubQueries(
throttleTime: number,
maxQueryTime: number,
queryDirectory: string,

View File

@@ -252,6 +252,7 @@ const DOUBLE_CLICK_TIME = 500;
const NO_QUERY_SELECTED = 'No query selected. Select a query history item you have already run and try again.';
const WORKSPACE_QUERY_HISTORY_FILE = 'workspace-query-history.json';
export class QueryHistoryManager extends DisposableObject {
treeDataProvider: HistoryTreeDataProvider;
@@ -275,7 +276,11 @@ export class QueryHistoryManager extends DisposableObject {
) {
super();
this.queryMetadataStorageLocation = path.join((ctx.storageUri || ctx.globalStorageUri).fsPath, 'query-history.json');
// Note that we use workspace storage to hold the metadata for the query history.
// This is because the query history is specific to each workspace.
// For situations where `ctx.storageUri` is undefined (i.e., there is no workspace),
// we default to global storage.
this.queryMetadataStorageLocation = path.join((ctx.storageUri || ctx.globalStorageUri).fsPath, WORKSPACE_QUERY_HISTORY_FILE);
this.treeDataProvider = this.push(new HistoryTreeDataProvider(
ctx.extensionPath

View File

@@ -273,7 +273,7 @@ describe('query-results', () => {
infoLateFailure,
];
const allHistoryPath = path.join(tmpDir.name, 'all-history.json');
const allHistoryPath = path.join(tmpDir.name, 'workspace-query-history.json');
// splat and slurp
await FullQueryInfo.splat(allHistory, allHistoryPath);