Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cubejs-backend/query-orchestrator

Package Overview
Dependencies
Maintainers
2
Versions
485
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cubejs-backend/query-orchestrator - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

test/QueryOrchestratorTest.js

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.12.1](https://github.com/cube-js/cube.js/compare/v0.12.0...v0.12.1) (2019-11-26)
### Features
* Show used pre-aggregations and match rollup results in Playground ([4a67346](https://github.com/cube-js/cube.js/commit/4a67346))
# [0.12.0](https://github.com/cube-js/cube.js/compare/v0.11.25...v0.12.0) (2019-11-25)

@@ -8,0 +19,0 @@

24

orchestrator/PreAggregations.js

@@ -190,3 +190,6 @@ const crypto = require('crypto');

} else {
return this.loadPreAggregationWithKeys();
return {
targetTableName: await this.loadPreAggregationWithKeys(),
refreshKeyValues: await this.getInvalidationKeyValues()
};
}

@@ -196,6 +199,3 @@ }

async loadPreAggregationWithKeys() {
const invalidationKeys = await Promise.all(
(this.preAggregation.invalidateKeyQueries || [])
.map(keyQuery => this.loadCache.keyQueryResult(keyQuery))
);
const invalidationKeys = await this.getInvalidationKeyValues();
const contentVersion = version([this.preAggregation.loadSql, invalidationKeys]);

@@ -280,2 +280,9 @@ const structureVersion = version(this.preAggregation.loadSql);

getInvalidationKeyValues() {
return Promise.all(
(this.preAggregation.invalidateKeyQueries || [])
.map(keyQuery => this.loadCache.keyQueryResult(keyQuery))
);
}
scheduleRefresh(invalidationKeys, newVersionEntry) {

@@ -435,5 +442,6 @@ this.logger('Refreshing pre-aggregation content', { preAggregation: this.preAggregation });

);
const preAggregationPromise = () => loader.loadPreAggregation().then(async tempTableName => {
await this.addTableUsed(tempTableName);
return [p.tableName, tempTableName];
const preAggregationPromise = () => loader.loadPreAggregation().then(async targetTableName => {
const usedPreAggregation = typeof targetTableName === 'string' ? { targetTableName } : targetTableName;
await this.addTableUsed(usedPreAggregation.targetTableName);
return [p.tableName, usedPreAggregation];
});

@@ -440,0 +448,0 @@ return preAggregationPromise().then(res => preAggregationsTablesToTempTables.concat([res]));

@@ -93,3 +93,3 @@ const crypto = require('crypto');

const replacedKeqQuery = preAggregationsTablesToTempTables.reduce(
(query, [tableName, tempTable]) => QueryCache.replaceAll(tableName, tempTable, query),
(query, [tableName, { targetTableName }]) => QueryCache.replaceAll(tableName, targetTableName, query),
keyQuery

@@ -96,0 +96,0 @@ );

@@ -0,1 +1,2 @@

const R = require('ramda');
const QueryCache = require('./QueryCache');

@@ -36,5 +37,11 @@ const PreAggregations = require('./PreAggregations');

return this.preAggregations.loadAllPreAggregationsIfNeeded(queryBody)
.then(preAggregationsTablesToTempTables => this.queryCache.cachedQueryResult(
queryBody, preAggregationsTablesToTempTables
));
.then(async preAggregationsTablesToTempTables => {
const result = await this.queryCache.cachedQueryResult(
queryBody, preAggregationsTablesToTempTables
);
return {
...result,
usedPreAggregations: R.fromPairs(preAggregationsTablesToTempTables)
};
});
}

@@ -41,0 +48,0 @@

@@ -5,3 +5,3 @@ {

"author": "Statsbot, Inc.",
"version": "0.12.0",
"version": "0.12.1",
"repository": {

@@ -29,3 +29,3 @@ "type": "git",

"license": "Apache-2.0",
"gitHead": "1e19567b8451359f9238f6efb8da1f2601bb06d8"
"gitHead": "acc2b442f8ccf979ea08b238aa106906e4517fd0"
}

@@ -0,4 +1,4 @@

/* globals describe,it */
const QueryQueue = require('../orchestrator/QueryQueue');
const should = require('should');
const redis = require('redis');

@@ -19,3 +19,3 @@ const QueryQueueTest = (name, options) => {

await setCancelHandler(result);
return await delayFn(result, query.delay);
return delayFn(result, query.delay);
}

@@ -61,2 +61,3 @@ },

if (e.message === 'Continue wait') {
// eslint-disable-next-line no-continue
continue;

@@ -94,3 +95,3 @@ }

for (let i = 1; i <= 4; i++) {
await queue.executeInQueue('delay', `11` + i, { delay: 50, result: '' + i }, 0);
await queue.executeInQueue('delay', `11` + i, { delay: 50, result: `${i}` }, 0);
}

@@ -97,0 +98,0 @@ cancelledQuery = null;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc