Skip to content

Commit 79d3f45

Browse files
committed
use cancel token
1 parent 989f687 commit 79d3f45

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/platform/notebooks/deepnote/sqlIntegrationEnvironmentVariablesProvider.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,17 @@ export class SqlIntegrationEnvironmentVariablesProvider {
9292
/**
9393
* Get environment variables for SQL integrations used in the given notebook.
9494
*/
95-
public async getEnvironmentVariables(
96-
resource: Resource,
97-
_token?: CancellationToken
98-
): Promise<EnvironmentVariables> {
95+
public async getEnvironmentVariables(resource: Resource, token?: CancellationToken): Promise<EnvironmentVariables> {
9996
const envVars: EnvironmentVariables = {};
10097

10198
if (!resource) {
10299
return envVars;
103100
}
104101

102+
if (token?.isCancellationRequested) {
103+
return envVars;
104+
}
105+
105106
logger.info(`SqlIntegrationEnvironmentVariablesProvider: Getting env vars for resource ${resource.toString()}`);
106107
logger.info(
107108
`SqlIntegrationEnvironmentVariablesProvider: Available notebooks: ${workspace.notebookDocuments
@@ -133,6 +134,10 @@ export class SqlIntegrationEnvironmentVariablesProvider {
133134

134135
// Get credentials for each integration and add to environment variables
135136
for (const integrationId of integrationIds) {
137+
if (token?.isCancellationRequested) {
138+
break;
139+
}
140+
136141
try {
137142
const config = await this.integrationStorage.get(integrationId);
138143
if (!config) {

0 commit comments

Comments
 (0)