File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2106,6 +2106,10 @@ def on_up(self, host):
21062106 with host .lock :
21072107 host .set_up ()
21082108 host ._currently_handling_node_up = False
2109+ for listener in self .listeners :
2110+ listener .on_up (host )
2111+ for session in tuple (self .sessions ):
2112+ session .update_created_pools ()
21092113
21102114 # for testing purposes
21112115 return futures
Original file line number Diff line number Diff line change @@ -352,6 +352,22 @@ def test_update_host_endpoint_notifies_listeners_for_live_host(self):
352352 session .remove_pool .assert_called_once_with (host )
353353 session .add_or_renew_pool .assert_called_once_with (host , is_host_addition = False )
354354
355+ def test_on_up_without_pool_futures_notifies_listeners (self ):
356+ cluster = Cluster (load_balancing_policy = RoundRobinPolicy (), protocol_version = 4 )
357+ self .addCleanup (cluster .shutdown )
358+
359+ host = Host (DefaultEndPoint ("127.0.0.1" ), SimpleConvictionPolicy , host_id = uuid .uuid4 ())
360+ host .set_down ()
361+ cluster .metadata .add_or_return_host (host )
362+
363+ listener = _RecordingHostStateListener ()
364+ cluster .register_listener (listener )
365+
366+ cluster .on_up (host )
367+
368+ assert host .is_up is True
369+ assert listener .events == [("up" , "127.0.0.1" )]
370+
355371 def test_update_host_endpoint_restarts_reconnector_when_replacement_pool_fails (self ):
356372 cluster = Cluster (load_balancing_policy = RoundRobinPolicy (), protocol_version = 4 )
357373 self .addCleanup (cluster .shutdown )
You can’t perform that action at this time.
0 commit comments