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


##########
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:
   Although all existing usages are fire-and-forget, I for sure want `await 
_refresh()` to actually finish refresh unless there is a strong reason not to 
do so and clearly warned in JSdoc, otherwise some unfortunate driver developer 
in the future will have a huge headache debugging some weird failure and 
yanking their hair out.



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