tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jorg...@apache.org
Subject [1/3] tinkerpop git commit: fix(DriverRemoteConnection): return the promise on close
Date Thu, 12 Jul 2018 09:53:37 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 309957bc2 -> b0c836b4e


fix(DriverRemoteConnection): return the promise on close

Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f6e50ae2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f6e50ae2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f6e50ae2

Branch: refs/heads/tp32
Commit: f6e50ae231ebd6cf9e488522967ad1d483de4781
Parents: 309957b
Author: Elliott Foster <elliottf@codebrews.com>
Authored: Tue Jul 3 12:35:55 2018 -0500
Committer: GitHub <noreply@github.com>
Committed: Tue Jul 3 12:35:55 2018 -0500

----------------------------------------------------------------------
 .../lib/driver/driver-remote-connection.js      | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f6e50ae2/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index d9e6000..0f7cedb 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -190,16 +190,16 @@ class DriverRemoteConnection extends RemoteConnection {
    * @return {Promise}
    */
   close() {
-    if (this._closePromise) {
-      return this._closePromise;
-    }
-    this._closePromise = new Promise(resolve => {
-      this._ws.on('close', function () {
-        this.isOpen = false;
-        resolve();
+    if (!this._closePromise) {
+      this._closePromise = new Promise(resolve => {
+        this._ws.on('close', function () {
+          this.isOpen = false;
+          resolve();
+        });
+        this._ws.close();
       });
-      this._ws.close();
-    });
+    }
+    return this._closePromise;
   }
 }
 
@@ -226,4 +226,4 @@ const bufferFromString = (Int8Array.from !== Buffer.from && Buffer.from)
|| func
   return new Buffer(text, 'utf8');
 };
 
-module.exports = DriverRemoteConnection;
\ No newline at end of file
+module.exports = DriverRemoteConnection;


Mime
View raw message