Skip to content

Commit 9423dd0

Browse files
committed
fixed PR review comments
1 parent 45a9561 commit 9423dd0

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

src/graph.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class Graph {
6464
*/
6565
async deleteGraph() {
6666
var res = await this._sendCommand("graph.DELETE", [this._graphId]);
67+
//clear internal graph state
6768
this._labels = [];
6869
this._relationshipTypes = [];
6970
this._properties = [];
@@ -89,15 +90,13 @@ class Graph {
8990
*/
9091
async labels() {
9192
if (this._labelsPromise == undefined) {
92-
console.info("fetching node labels")
9393
this._labelsPromise = this.callProcedure("db.labels").then(response => {
9494
return this._extractStrings(response);
9595
})
9696
this._labels = await (this._labelsPromise);
9797
this._labelsPromise = undefined;
9898
}
9999
else {
100-
console.info("waiting for label promise");
101100
await this._labelsPromise;
102101
}
103102
}
@@ -107,35 +106,29 @@ class Graph {
107106
*/
108107
async relationshipTypes() {
109108
if (this._relationshipPromise == undefined) {
110-
console.info("fetching relationship types");
111109
this._relationshipPromise = this.callProcedure("db.relationshipTypes").then(response => {
112110
return this._extractStrings(response);
113111
});
114112
this._relationshipTypes = await (this._relationshipPromise);
115113
this._relationshipPromise = undefined;
116114
}
117115
else {
118-
console.info("waiting for relationship promise");
119116
await this._relationshipPromise;
120117
}
121-
122-
123118
}
124119

125120
/**
126121
* Retrieves all properties in graph.
127122
*/
128123
async propertyKeys() {
129124
if (this._propertyPromise == undefined) {
130-
console.info("fetching property names");
131125
this._propertyPromise = this.callProcedure("db.propertyKeys").then(response => {
132126
return this._extractStrings(response);
133127
})
134128
this._properties = await this._propertyPromise;
135129
this._propertyPromise = undefined;
136130
}
137131
else{
138-
console.info("waiting for property promise");
139132
await this._propertyPromise;
140133
}
141134

src/resultSet.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@ class ResultSet {
114114
let prop = props[i];
115115
var propIndex = prop[0];
116116
let prop_name = this._graph.getProperty(propIndex);
117-
var x = 0;
118-
while (prop_name == undefined && x <10) {
117+
//will try to get the right property for at most 10 times
118+
var tries = 0;
119+
while (prop_name == undefined && tries <10) {
119120
prop_name = await this._graph.fetchAndGetProperty(propIndex);
120-
x++;
121+
tries++;
121122
}
122123
if (prop_name == undefined) {
123124
console.log("unable to retrive property name value for propety index " + propIndex);
@@ -135,9 +136,10 @@ class ResultSet {
135136

136137
let node_id = cell[0];
137138
let label = this._graph.getLabel(cell[1][0]);
138-
var x = 0;
139-
while (label == undefined && x < 10) {
140-
label = await this._graph.fetchAndGetLabel(cell[1][0]);
139+
//will try to get the right label for at most 10 times
140+
var tries = 0;
141+
while (label == undefined && tries < 10) {
142+
tries = await this._graph.fetchAndGetLabel(cell[1][0]);
141143
x++;
142144
}
143145
if (label == undefined) {
@@ -158,10 +160,11 @@ class ResultSet {
158160

159161
let edge_id = cell[0];
160162
let relation = this._graph.getRelationship(cell[1]);
161-
var x = 0;
162-
while (relation == undefined && x < 10) {
163+
//will try to get the right relationship type for at most 10 times
164+
var tries = 0;
165+
while (relation == undefined && tries < 10) {
163166
relation = await this._graph.fetchAndGetRelationship(cell[1])
164-
x++;
167+
tries++;
165168
}
166169
if (relation == undefined) {
167170
console.log("unable to retrive relationship type value for relationship index " + cell[1]);

0 commit comments

Comments
 (0)