Skip to content

Commit 53ffdc3

Browse files
committed
Remove remote queries manager
1 parent f6d7ddf commit 53ffdc3

File tree

8 files changed

+10
-730
lines changed

8 files changed

+10
-730
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ import {
101101
withProgress,
102102
} from "./commandRunner";
103103
import { CodeQlStatusBarHandler } from "./status-bar";
104-
105-
import { RemoteQueriesManager } from "./remote-queries/remote-queries-manager";
106104
import { URLSearchParams } from "url";
107105
import {
108106
handleDownloadPacks,
@@ -652,23 +650,12 @@ async function activateWithInstalledDistribution(
652650
),
653651
);
654652

655-
void extLogger.log("Initializing remote queries manager.");
656-
const rqm = new RemoteQueriesManager(
657-
ctx,
658-
app,
659-
cliServer,
660-
queryStorageDir,
661-
extLogger,
662-
);
663-
ctx.subscriptions.push(rqm);
664-
665653
void extLogger.log("Initializing query history.");
666654
const qhm = new QueryHistoryManager(
667655
app,
668656
qs,
669657
dbm,
670658
localQueryResultsView,
671-
rqm,
672659
variantAnalysisManager,
673660
evalLogViewer,
674661
queryStorageDir,

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import { pathExists } from "fs-extra";
5454
import { CliVersionConstraint } from "../cli";
5555
import { HistoryItemLabelProvider } from "./history-item-label-provider";
5656
import { cancelRemoteQuery } from "../remote-queries/gh-api/gh-actions-api-client";
57-
import { RemoteQueriesManager } from "../remote-queries/remote-queries-manager";
5857
import { RemoteQueryHistoryItem } from "../remote-queries/remote-query-history-item";
5958
import { ResultsView } from "../interface";
6059
import { WebviewReveal } from "../interface-utils";
@@ -142,7 +141,6 @@ export class QueryHistoryManager extends DisposableObject {
142141
private readonly qs: QueryRunner,
143142
private readonly dbm: DatabaseManager,
144143
private readonly localQueriesResultsView: ResultsView,
145-
private readonly remoteQueriesManager: RemoteQueriesManager,
146144
private readonly variantAnalysisManager: VariantAnalysisManager,
147145
private readonly evalLogViewer: EvalLogViewer,
148146
private readonly queryStorageDir: string,
@@ -372,7 +370,6 @@ export class QueryHistoryManager extends DisposableObject {
372370
);
373371

374372
this.registerQueryHistoryScrubber(queryHistoryConfigListener, this, ctx);
375-
this.registerToRemoteQueriesEvents();
376373
this.registerToVariantAnalysisEvents();
377374
}
378375

@@ -477,57 +474,6 @@ export class QueryHistoryManager extends DisposableObject {
477474
this.push(variantAnalysisRemovedSubscription);
478475
}
479476

480-
private registerToRemoteQueriesEvents() {
481-
const queryAddedSubscription = this.remoteQueriesManager.onRemoteQueryAdded(
482-
async (event) => {
483-
this.addQuery({
484-
t: "remote",
485-
status: QueryStatus.InProgress,
486-
completed: false,
487-
queryId: event.queryId,
488-
remoteQuery: event.query,
489-
});
490-
491-
await this.refreshTreeView();
492-
},
493-
);
494-
495-
const queryRemovedSubscription =
496-
this.remoteQueriesManager.onRemoteQueryRemoved(async (event) => {
497-
const item = this.treeDataProvider.allHistory.find(
498-
(i) => i.t === "remote" && i.queryId === event.queryId,
499-
);
500-
if (item) {
501-
await this.removeRemoteQuery(item as RemoteQueryHistoryItem);
502-
}
503-
});
504-
505-
const queryStatusUpdateSubscription =
506-
this.remoteQueriesManager.onRemoteQueryStatusUpdate(async (event) => {
507-
const item = this.treeDataProvider.allHistory.find(
508-
(i) => i.t === "remote" && i.queryId === event.queryId,
509-
);
510-
if (item) {
511-
const remoteQueryHistoryItem = item as RemoteQueryHistoryItem;
512-
remoteQueryHistoryItem.status = event.status;
513-
remoteQueryHistoryItem.failureReason = event.failureReason;
514-
remoteQueryHistoryItem.resultCount = event.resultCount;
515-
if (event.status === QueryStatus.Completed) {
516-
remoteQueryHistoryItem.completed = true;
517-
}
518-
await this.refreshTreeView();
519-
} else {
520-
void extLogger.log(
521-
"Variant analysis status update event received for unknown variant analysis",
522-
);
523-
}
524-
});
525-
526-
this.push(queryAddedSubscription);
527-
this.push(queryRemovedSubscription);
528-
this.push(queryStatusUpdateSubscription);
529-
}
530-
531477
async readQueryHistory(): Promise<void> {
532478
void extLogger.log(
533479
`Reading cached query history from '${this.queryMetadataStorageLocation}'.`,
@@ -538,9 +484,6 @@ export class QueryHistoryManager extends DisposableObject {
538484
this.treeDataProvider.allHistory = history;
539485
await Promise.all(
540486
this.treeDataProvider.allHistory.map(async (item) => {
541-
if (item.t === "remote") {
542-
await this.remoteQueriesManager.rehydrateRemoteQuery(item.queryId);
543-
}
544487
if (item.t === "variant-analysis") {
545488
await this.variantAnalysisManager.rehydrateVariantAnalysis(
546489
item.variantAnalysis,
@@ -653,7 +596,7 @@ export class QueryHistoryManager extends DisposableObject {
653596
await item.completedQuery?.query.deleteQuery();
654597
}
655598
} else if (item.t === "remote") {
656-
await this.removeRemoteQuery(item);
599+
// Do nothing. TODO: Remove once remote queries are no longer supported.
657600
} else if (item.t === "variant-analysis") {
658601
await this.removeVariantAnalysis(item);
659602
} else {
@@ -670,20 +613,6 @@ export class QueryHistoryManager extends DisposableObject {
670613
}
671614
}
672615

673-
private async removeRemoteQuery(item: RemoteQueryHistoryItem): Promise<void> {
674-
// Remote queries can be removed locally, but not remotely.
675-
// The user must cancel the query on GitHub Actions explicitly.
676-
this.treeDataProvider.remove(item);
677-
void extLogger.log(`Deleted ${this.labelProvider.getLabel(item)}.`);
678-
if (item.status === QueryStatus.InProgress) {
679-
void extLogger.log(
680-
"The variant analysis is still running on GitHub Actions. To cancel there, you must go to the workflow run in your browser.",
681-
);
682-
}
683-
684-
await this.remoteQueriesManager.removeRemoteQuery(item.queryId);
685-
}
686-
687616
private async removeVariantAnalysis(
688617
item: VariantAnalysisHistoryItem,
689618
): Promise<void> {
@@ -1547,9 +1476,11 @@ the file in the file explorer and dragging it into the workspace.`,
15471476
false,
15481477
);
15491478
} else if (item.t === "remote") {
1550-
await this.remoteQueriesManager.openRemoteQueryResults(item.queryId);
1479+
// Do nothing. TODO: Remove when remote queries is no longer supported.
15511480
} else if (item.t === "variant-analysis") {
15521481
await this.variantAnalysisManager.showView(item.variantAnalysis.id);
1482+
} else {
1483+
assertNever(item);
15531484
}
15541485
}
15551486
}

0 commit comments

Comments
 (0)