Skip to content

Commit

Permalink
cubestore cache driver earlier exit
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Oct 24, 2022
1 parent b579c27 commit 08e577e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"@typescript-eslint/eslint-plugin": "^4.17.0",
"core-js": "^3.6.5",
"lerna": "^3.13.1",
"patch-package": "^6.4.7",
"ramda": "^0.27.0",
"rollup-plugin-dts": "^1.1.8",
"patch-package": "^6.4.7",
"whatwg-fetch": "^3.0.0"
},
"files": [
Expand Down
4 changes: 4 additions & 0 deletions packages/cubejs-cubestore-driver/src/CubeStoreCacheDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class CubeStoreCacheDriver implements CacheDriverInterface {

const rows = await this.connection.query(`CACHE SET NX TTL ${expiration} ? ?`, [key, '1']);
if (rows && rows.length === 1 && rows[0]?.success === 'true') {
if (tkn.isCanceled()) {
return false;
}

try {
await tkn.with(cb());
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export class RedisCacheDriver implements CacheDriverInterface {
);

if (response === 'OK') {
if (tkn.isCanceled()) {
return false;
}

try {
await tkn.with(cb());
} finally {
Expand Down

0 comments on commit 08e577e

Please sign in to comment.