SiyaoIsHiding commented on code in PR #462:
URL: 
https://github.com/apache/cassandra-nodejs-driver/pull/462#discussion_r3352757595


##########
lib/control-connection.js:
##########
@@ -446,13 +441,31 @@ class ControlConnection extends events.EventEmitter {
   }
 
   /**
-   * Acquires a new connection and refreshes topology and keyspace metadata.
+   * Acquires a new connection and refreshes topology and keyspace metadata, 
with protection against concurrent refreshes.
    * <p>When it fails obtaining a connection and there aren't any more hosts, 
it schedules reconnection.</p>
    * <p>When it fails obtaining the metadata, it marks connection and/or host 
unusable and retries using the same
    * iterator from query plan / host list</p>
    * @param {Iterator<Host>} [hostIterator]
    */
   async _refresh(hostIterator) {
+    if (this._refreshInProgress) {
+      return;

Review Comment:
   Why not 
   ```js
       if (this._refreshInProgress) {
         return this._refreshPromise;
       }
   ```
   It makes more sense because developers would expect that after the execution 
of `await _refresh()`, the refresh should actually be complete.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to