Skip to content

Commit

Permalink
fix: Various cleanup errors
Browse files Browse the repository at this point in the history
Fixes #525
  • Loading branch information
paveltiunov committed Mar 21, 2020
1 parent ec0b851 commit 538f6d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ class QueryOrchestrator {
}

async cleanup() {
await this.redisPool.cleanup();
if (this.redisPool) {
await this.redisPool.cleanup();
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/cubejs-server-core/core/OrchestratorApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class OrchestratorApi {
release() {
return Promise.all([
this.releaseDriver(this.driverFactory),
this.releaseDriver(this.externalDriverFactory)
this.releaseDriver(this.externalDriverFactory),
this.orchestrator.cleanup()
]);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/cubejs-server-core/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class CubejsServerCore {
}
return driverPromise;
},
getExternalDriverFactory: async () => {
getExternalDriverFactory: this.externalDriverFactory && (async () => {
if (!externalPreAggregationsDriverPromise) {
const driver = await this.externalDriverFactory(context);
externalPreAggregationsDriverPromise = driver.testConnection().then(() => driver).catch(e => {
Expand All @@ -431,7 +431,7 @@ class CubejsServerCore {
});
}
return externalPreAggregationsDriverPromise;
},
}),
redisPrefix: dataSourceId,
orchestratorOptions: this.orchestratorOptions(context)
});
Expand Down

0 comments on commit 538f6d0

Please sign in to comment.