Skip to content

Commit 45a9561

Browse files
author
DvirDukhan
committed
PR comments fixed
1 parent 5c98969 commit 45a9561

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

src/graph.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class Graph {
1616
* @param options node_redis options
1717
*/
1818
constructor(graphId, host, port, options) {
19-
this._graphId = graphId; // Graph ID
20-
this._labels = []; // List of node labels.
21-
this._relationshipTypes = []; // List of relation types.
22-
this._properties = []; // List of properties.
23-
24-
this._labelsPromise = undefined;
25-
this._propertyPromise = undefined;
26-
this._relationshipPromise = undefined;
19+
this._graphId = graphId; // Graph ID
20+
this._labels = []; // List of node labels.
21+
this._relationshipTypes = []; // List of relation types.
22+
this._properties = []; // List of properties.
23+
24+
this._labelsPromise = undefined; // used as a synchronization mechanizom for labels retrival
25+
this._propertyPromise = undefined; // used as a synchronization mechanizom for property names retrival
26+
this._relationshipPromise = undefined; // used as a synchronization mechanizom for relationship types retrival
2727

2828
let client =
2929
host instanceof redis.RedisClient

src/resultSet.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,13 @@ class ResultSet {
114114
let prop = props[i];
115115
var propIndex = prop[0];
116116
let prop_name = this._graph.getProperty(propIndex);
117-
while (prop_name == undefined) {
117+
var x = 0;
118+
while (prop_name == undefined && x <10) {
118119
prop_name = await this._graph.fetchAndGetProperty(propIndex);
120+
x++;
121+
}
122+
if (prop_name == undefined) {
123+
console.log("unable to retrive property name value for propety index " + propIndex);
119124
}
120125
let prop_value = this.parseScalar(prop.slice(1, prop.length));
121126
properties[prop_name] = prop_value;
@@ -130,8 +135,13 @@ class ResultSet {
130135

131136
let node_id = cell[0];
132137
let label = this._graph.getLabel(cell[1][0]);
133-
while (label == undefined) {
138+
var x = 0;
139+
while (label == undefined && x < 10) {
134140
label = await this._graph.fetchAndGetLabel(cell[1][0]);
141+
x++;
142+
}
143+
if (label == undefined) {
144+
console.log("unable to retrive label value for label index " + cell[1][0]);
135145
}
136146
let properties = await this.parseEntityProperties(cell[2]);
137147
let node = new Node(label, properties);
@@ -148,8 +158,13 @@ class ResultSet {
148158

149159
let edge_id = cell[0];
150160
let relation = this._graph.getRelationship(cell[1]);
151-
while (relation == undefined) {
161+
var x = 0;
162+
while (relation == undefined && x < 10) {
152163
relation = await this._graph.fetchAndGetRelationship(cell[1])
164+
x++;
165+
}
166+
if (relation == undefined) {
167+
console.log("unable to retrive relationship type value for relationship index " + cell[1]);
153168
}
154169
let src_node_id = cell[2];
155170
let dest_node_id = cell[3];

test/redisGraphAPITest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe('RedisGraphAPI Test', () => {
176176
assert.equal("roi", n.properties['name']);
177177
assert.equal("person", n.label);
178178
assert.equal(0, n.id);
179-
console.log("ok")
179+
console.info("ok")
180180
}
181181
});
182182
})

0 commit comments

Comments
 (0)