File tree Expand file tree Collapse file tree
java/src/org/openqa/selenium/grid/distributor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,15 +178,22 @@ public void refresh(NodeStatus status) {
178178 }
179179 }
180180
181- public void touch (NodeId id ) {
182- Require .nonNull ("Node ID" , id );
181+ public void touch (NodeStatus nodeStatus ) {
182+ Require .nonNull ("Node ID" , nodeStatus );
183183
184184 Lock writeLock = lock .writeLock ();
185185 writeLock .lock ();
186186 try {
187- NodeStatus node = getNode (id );
187+ NodeStatus node = getNode (nodeStatus . getNodeId () );
188188 if (node != null ) {
189189 nodePurgeTimes .put (node .getNodeId (), Instant .now ());
190+ // Covers the case where the Node might be DOWN in the Grid model (e.g. Node lost
191+ // connectivity for a while). The Node reports itself back as UP.
192+ if (node .getAvailability () != nodeStatus .getAvailability ()
193+ && nodeStatus .getAvailability () == UP ) {
194+ nodes .remove (node );
195+ nodes .add (nodeStatus );
196+ }
190197 }
191198 } finally {
192199 writeLock .unlock ();
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ public LocalDistributor(
205205 NodeHeartBeatEvent .listener (
206206 nodeStatus -> {
207207 if (nodes .containsKey (nodeStatus .getNodeId ())) {
208- model .touch (nodeStatus . getNodeId () );
208+ model .touch (nodeStatus );
209209 } else {
210210 register (nodeStatus );
211211 }
You can’t perform that action at this time.
0 commit comments