diff --git a/src/dbt_client/dbtCloudIntegration.ts b/src/dbt_client/dbtCloudIntegration.ts index accbd2147..54ef087de 100644 --- a/src/dbt_client/dbtCloudIntegration.ts +++ b/src/dbt_client/dbtCloudIntegration.ts @@ -238,7 +238,12 @@ export class DBTCloudProjectIntegration } if (!this.adapterType) { // We only fetch the adapter type once, as it may impact compilation preview otherwise - this.findAdapterType(); + const startTime = Date.now(); + await this.findAdapterType(); + const elapsedTime = Date.now() - startTime; + this.telemetry.sendTelemetryEvent("cloudFindAdapterTypeElapsedTime", { + elapsedTime: elapsedTime.toString(), + }); } if (!this.version) { await this.findVersion(); @@ -1023,6 +1028,21 @@ export class DBTCloudProjectIntegration } } + private firstRun = false; + private async retryOnce() { + if (this.firstRun) { + return; + } + this.firstRun = true; + const startTime = Date.now(); + await this.findAdapterType(); + const elapsedTime = Date.now() - startTime; + this.telemetry.sendTelemetryEvent("cloudFindAdapterTypeElapsedTime", { + elapsedTime: elapsedTime.toString(), + retry: "true", + }); + } + private async findAdapterType() { const adapterTypeCommand = this.dbtCloudCommand( new DBTCommand("Getting adapter type...", [ @@ -1063,6 +1083,11 @@ export class DBTCloudProjectIntegration error, ); } + if (!this.adapterType) { + setTimeout(() => { + this.retryOnce(); + }, 5000); + } } private async findVersion() {