Skip to content

Commit 5d88fed

Browse files
committed
BREAKING CHANGE: Use cubestore driver for queue & cache
1 parent bb0a0e7 commit 5d88fed

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

packages/cubejs-oracle-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@cubejs-backend/oracle-driver",
33
"description": "Cube.js oracle database driver",
4-
"author": "Trikoz I.",
4+
"author": "Cube Dev, Inc.",
55
"version": "0.31.67",
66
"repository": {
77
"type": "git",

packages/cubejs-query-orchestrator/src/orchestrator/QueryOrchestrator.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ export interface QueryOrchestratorOptions {
3030
skipExternalCacheAndQueue?: boolean;
3131
}
3232

33+
function detectQueueAndCacheDriver(options: QueryOrchestratorOptions): CacheAndQueryDriverType {
34+
if (options.cacheAndQueueDriver) {
35+
return options.cacheAndQueueDriver;
36+
}
37+
38+
if (getEnv('cacheAndQueueDriver')) {
39+
return getEnv('cacheAndQueueDriver');
40+
}
41+
42+
if (getEnv('redisUrl') || getEnv('redisUseIORedis')) {
43+
return 'redis';
44+
}
45+
46+
if (getEnv('nodeEnv') === 'production') {
47+
return 'cubestore';
48+
}
49+
50+
return 'memory';
51+
}
52+
3353
export class QueryOrchestrator {
3454
protected readonly queryCache: QueryCache;
3555

@@ -50,22 +70,19 @@ export class QueryOrchestrator {
5070
options: QueryOrchestratorOptions = {}
5171
) {
5272
this.rollupOnlyMode = options.rollupOnlyMode;
53-
54-
const cacheAndQueueDriver = options.cacheAndQueueDriver || getEnv('cacheAndQueueDriver') || (
55-
(getEnv('nodeEnv') === 'production' || getEnv('redisUrl') || getEnv('redisUseIORedis'))
56-
? 'redis'
57-
: 'memory'
58-
);
59-
this.cacheAndQueueDriver = cacheAndQueueDriver;
73+
const cacheAndQueueDriver = detectQueueAndCacheDriver(options);
6074

6175
if (!['redis', 'memory', 'cubestore'].includes(cacheAndQueueDriver)) {
62-
throw new Error('Only \'redis\', \'memory\' or \'cubestore\' are supported for cacheAndQueueDriver option');
76+
throw new Error(
77+
`Only 'cubestore', 'redis' or 'memory' are supported for cacheAndQueueDriver option, passed: ${cacheAndQueueDriver}`
78+
);
6379
}
6480

6581
const { externalDriverFactory, continueWaitTimeout, skipExternalCacheAndQueue } = options;
6682

6783
const redisPool = cacheAndQueueDriver === 'redis' ? new RedisPool(options.redisPoolOptions) : undefined;
6884
this.redisPool = redisPool;
85+
this.cacheAndQueueDriver = cacheAndQueueDriver;
6986

7087
const cubeStoreDriverFactory = cacheAndQueueDriver === 'cubestore' ? async () => {
7188
if (externalDriverFactory) {

0 commit comments

Comments
 (0)