Skip to content

Commit

Permalink
2.0.57 (#946)
Browse files Browse the repository at this point in the history
* Optimize event connection query (#945)
* Use arangojs v6.10.0
* Update version to 2.0.57
  • Loading branch information
kipliklotrika authored Jul 8, 2019
1 parent bd197ff commit 53f565a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 45 deletions.
50 changes: 27 additions & 23 deletions modules/Database/Arangojs.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,30 +747,34 @@ class ArangoJS {
// AND @senderId in v.partner_id AND v.sender_id in @partnerId ' +
// 'RETURN v';

const queryString = `FOR v IN ot_vertices
FILTER v.vertex_type == 'EVENT' and v.encrypted == null
RETURN v`;
const params = {};
const result = await this.runQuery(queryString, params);
if (documentId == null || bizStep == null || partnerId == null || senderId == null) {
return [];
}

return result.filter((event) => {
if (partnerId.indexOf(event.sender_id) !== -1) {
for (const key in event) {
if (event[key].data) {
const { data } = event[key];

if (data.bizStep
&& data.bizStep.endsWith(bizStep)
&& data.extension
&& data.extension.extension
&& data.extension.extension.documentId === documentId) {
return true;
}
}
}
}
return false;
});
const queryString = `let e = (
FOR v IN ot_vertices
FILTER v.datasets != null AND v.vertex_type == 'EVENT'
FILTER v.encrypted == null
LET events = (
FOR dataset IN v.datasets
FILTER v[dataset].data != null
FILTER v[dataset].data.bizStep LIKE @bizStep
FILTER v[dataset].data.extension != null
FILTER v[dataset].data.extension.extension != null
FILTER v[dataset].data.extension.extension.documentId == @documentId
FILTER @senderId IN v[dataset].data.partner_id
RETURN v
)
return events
)
return FLATTEN(e)`;
const params = {
bizStep: `%${bizStep}`,
documentId,
senderId,
};
const result = await this.runQuery(queryString, params);
return result[0];
}

/**
Expand Down
31 changes: 11 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "2.0.56",
"version": "2.0.57",
"description": "OriginTrail node",
"main": ".eslintrc.js",
"config": {
Expand Down Expand Up @@ -73,7 +73,7 @@
"@garbados/merkle-tree": "^1.0.3-alpha",
"@kadenceproject/kadence": "^4.4.0",
"ajv": "^5.5.2",
"arangojs": "^5.8.0",
"arangojs": "^6.10.0",
"async": "^2.6.0",
"async-retry": "^1.2.1",
"auto-updater": "git+https://github.com/OriginTrail/auto-updater.git#v1.1.0",
Expand Down

0 comments on commit 53f565a

Please sign in to comment.