@@ -86,6 +86,7 @@ import {
8686 extLogger ,
8787 languageServerLogger ,
8888 queryServerLogger ,
89+ queryServerForWarmingOverlayBaseCacheLogger ,
8990} from "./common/logging/vscode" ;
9091import { QueryHistoryManager } from "./query-history/query-history-manager" ;
9192import type { CompletedLocalQueryInfo } from "./query-results" ;
@@ -172,6 +173,7 @@ function getCommands(
172173 app : App ,
173174 cliServer : CodeQLCliServer ,
174175 queryRunner : QueryRunner ,
176+ queryRunnerForWarmingOverlayBaseCache : QueryRunner ,
175177 languageClient : LanguageClient ,
176178) : BaseCommands {
177179 const getCliVersion = async ( ) => {
@@ -189,6 +191,7 @@ function getCommands(
189191 cliServer . restartCliServer ( ) ;
190192 await Promise . all ( [
191193 queryRunner . restartQueryServer ( progress ) ,
194+ queryRunnerForWarmingOverlayBaseCache . restartQueryServer ( progress ) ,
192195 async ( ) => {
193196 if ( languageClient . isRunning ( ) ) {
194197 await languageClient . restart ( ) ;
@@ -201,6 +204,10 @@ function getCommands(
201204 queryServerLogger ,
202205 "CodeQL Query Server restarted." ,
203206 ) ;
207+ void showAndLogErrorMessage (
208+ queryServerForWarmingOverlayBaseCacheLogger ,
209+ "CodeQL Query Server for warming underlay caches restarted." ,
210+ ) ;
204211 } ,
205212 {
206213 title : "Restarting Query Server" ,
@@ -281,6 +288,7 @@ export interface CodeQLExtensionInterface {
281288 readonly ctx : ExtensionContext ;
282289 readonly cliServer : CodeQLCliServer ;
283290 readonly qs : QueryRunner ;
291+ readonly WarmOverlayBaseCacheQs : QueryRunner ;
284292 readonly distributionManager : DistributionManager ;
285293 readonly databaseManager : DatabaseManager ;
286294 readonly databaseUI : DatabaseUI ;
@@ -795,6 +803,16 @@ async function activateWithInstalledDistribution(
795803 qlConfigurationListener ,
796804 cliServer ,
797805 ctx ,
806+ false ,
807+ ) ;
808+
809+ void extLogger . log ( "Initializing base cache warming query server client." ) ;
810+ const WarmOverlayBaseCacheQs = await createQueryServer (
811+ app ,
812+ qlConfigurationListener ,
813+ cliServer ,
814+ ctx ,
815+ true ,
798816 ) ;
799817
800818 for ( const glob of CLEAR_PACK_CACHE_ON_EDIT_GLOBS ) {
@@ -822,6 +840,7 @@ async function activateWithInstalledDistribution(
822840 ctx ,
823841 app ,
824842 qs ,
843+ WarmOverlayBaseCacheQs ,
825844 cliServer ,
826845 languageContext ,
827846 extLogger ,
@@ -998,6 +1017,7 @@ async function activateWithInstalledDistribution(
9981017 const localQueries = new LocalQueries (
9991018 app ,
10001019 qs ,
1020+ WarmOverlayBaseCacheQs ,
10011021 qhm ,
10021022 dbm ,
10031023 databaseFetcher ,
@@ -1062,7 +1082,7 @@ async function activateWithInstalledDistribution(
10621082 void extLogger . log ( "Registering top-level command palette commands." ) ;
10631083
10641084 const allCommands : AllExtensionCommands = {
1065- ...getCommands ( app , cliServer , qs , languageClient ) ,
1085+ ...getCommands ( app , cliServer , qs , WarmOverlayBaseCacheQs , languageClient ) ,
10661086 ...getQueryEditorCommands ( {
10671087 commandManager : app . commands ,
10681088 queryRunner : qs ,
@@ -1165,6 +1185,7 @@ async function activateWithInstalledDistribution(
11651185 cliServer,
11661186 localQueries,
11671187 qs,
1188+ WarmOverlayBaseCacheQs,
11681189 distributionManager,
11691190 databaseManager : dbm ,
11701191 databaseUI,
@@ -1278,9 +1299,12 @@ async function createQueryServer(
12781299 qlConfigurationListener : QueryServerConfigListener ,
12791300 cliServer : CodeQLCliServer ,
12801301 ctx : ExtensionContext ,
1302+ warmOverlayBaseCache : boolean ,
12811303) : Promise < QueryRunner > {
12821304 const qsOpts = {
1283- logger : queryServerLogger ,
1305+ logger : warmOverlayBaseCache
1306+ ? queryServerForWarmingOverlayBaseCacheLogger
1307+ : queryServerLogger ,
12841308 contextStoragePath : getContextStoragePath ( ctx ) ,
12851309 } ;
12861310 const progressCallback = (
@@ -1290,13 +1314,19 @@ async function createQueryServer(
12901314 ) => Thenable < void > ,
12911315 ) =>
12921316 Window . withProgress (
1293- { title : "CodeQL query server" , location : ProgressLocation . Window } ,
1317+ {
1318+ title : warmOverlayBaseCache
1319+ ? "CodeQL query server for warming underlay caches"
1320+ : "CodeQL query server" ,
1321+ location : ProgressLocation . Window ,
1322+ } ,
12941323 task ,
12951324 ) ;
12961325
12971326 const qs = new QueryServerClient (
12981327 app ,
12991328 qlConfigurationListener ,
1329+ warmOverlayBaseCache ,
13001330 cliServer ,
13011331 qsOpts ,
13021332 progressCallback ,
0 commit comments