toptobes commented on code in PR #471:
URL:
https://github.com/apache/cassandra-nodejs-driver/pull/471#discussion_r3678542709
##########
lib/control-connection.js:
##########
@@ -598,14 +598,23 @@ class ControlConnection extends events.EventEmitter {
self.log('warning', 'Received status change event but host was not
found: ' + addressToTranslate);
return;
}
+
+ const existingTimer = self._nodeStatusChangeTimers.get(endPoint);
+ if (existingTimer) {
+ clearTimeout(existingTimer);
+ self._nodeStatusChangeTimers.delete(endPoint);
+ }
+
const distance = self._profileManager.getDistance(host);
if (event.up) {
if (distance === types.distance.ignored) {
return host.setUp(true);
}
- clearTimeout(self._nodeStatusChangeTimeout);
// Waits a couple of seconds before marking it as UP
- self._nodeStatusChangeTimeout = setTimeout(() => host.checkIsUp(),
newNodeDelay);
+ self._nodeStatusChangeTimers.set(endPoint, setTimeout(() => {
+ self._nodeStatusChangeTimers.delete(endPoint);
Review Comment:
I mean, technically no? But there's not much point keeping dead timer ids
around even if they'll be overwritten anyway, it's mostly a minor memory thing.
--
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]