@@ -3500,7 +3500,7 @@ async def close(self, fast=False, close_workers=False):
3500
3500
await future
3501
3501
3502
3502
for comm in self .client_comms .values ():
3503
- comm .abort ()
3503
+ await comm .close ()
3504
3504
3505
3505
await self .rpc .close ()
3506
3506
@@ -3732,7 +3732,7 @@ async def add_worker(
3732
3732
# for key in keys: # TODO
3733
3733
# self.mark_key_in_memory(key, [address])
3734
3734
3735
- self .stream_comms [address ] = BatchedSend (interval = "5ms" , loop = self . loop )
3735
+ self .stream_comms [address ] = BatchedSend (interval = "5ms" )
3736
3736
3737
3737
if ws .nthreads > len (ws .processing ):
3738
3738
self .idle [ws .address ] = ws
@@ -4316,7 +4316,7 @@ async def remove_worker(self, address, stimulus_id, safe=False, close=True):
4316
4316
4317
4317
logger .info ("Remove worker %s" , ws )
4318
4318
if close :
4319
- with suppress (AttributeError , CommClosedError ):
4319
+ with suppress (AttributeError ):
4320
4320
self .stream_comms [address ].send ({"op" : "close" , "report" : False })
4321
4321
4322
4322
self .remove_resources (address )
@@ -4330,6 +4330,7 @@ async def remove_worker(self, address, stimulus_id, safe=False, close=True):
4330
4330
del self .host_info [host ]
4331
4331
4332
4332
self .rpc .remove (address )
4333
+ await self .stream_comms [address ].close ()
4333
4334
del self .stream_comms [address ]
4334
4335
del self .aliases [ws .name ]
4335
4336
self .idle .pop (ws .address , None )
@@ -4684,7 +4685,7 @@ async def add_client(
4684
4685
logger .exception (e )
4685
4686
4686
4687
try :
4687
- bcomm = BatchedSend (interval = "2ms" , loop = self . loop )
4688
+ bcomm = BatchedSend (interval = "2ms" )
4688
4689
bcomm .start (comm )
4689
4690
self .client_comms [client ] = bcomm
4690
4691
msg = {"op" : "stream-start" }
@@ -5032,13 +5033,7 @@ def client_send(self, client, msg):
5032
5033
c = client_comms .get (client )
5033
5034
if c is None :
5034
5035
return
5035
- try :
5036
- c .send (msg )
5037
- except CommClosedError :
5038
- if self .status == Status .running :
5039
- logger .critical (
5040
- "Closed comm %r while trying to write %s" , c , msg , exc_info = True
5041
- )
5036
+ c .send (msg )
5042
5037
5043
5038
def send_all (self , client_msgs : dict , worker_msgs : dict ):
5044
5039
"""Send messages to client and workers"""
@@ -5068,7 +5063,7 @@ def send_all(self, client_msgs: dict, worker_msgs: dict):
5068
5063
except KeyError :
5069
5064
# worker already gone
5070
5065
pass
5071
- except ( CommClosedError , AttributeError ) :
5066
+ except AttributeError :
5072
5067
self .loop .add_callback (
5073
5068
self .remove_worker ,
5074
5069
address = worker ,
0 commit comments