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


##########
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:
   returning an auto-resolving promise here would defer the _refresh call to 
the microtask queue which may or may not open a hole for a race condition–I 
haven't checked.
   
   I don't think it's necessary to return one, but if we do, it's definitely 
something that needs to be done with at least a little caution



-- 
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