@@ -46,7 +46,7 @@ class Connection(metaclass=ConnectionMeta):
46
46
'_listeners' , '_server_version' , '_server_caps' ,
47
47
'_intro_query' , '_reset_query' , '_proxy' ,
48
48
'_stmt_exclusive_section' , '_config' , '_params' , '_addr' ,
49
- '_log_listeners' , '_cleanup_listeners ' , '_cancellations' ,
49
+ '_log_listeners' , '_close_listeners ' , '_cancellations' ,
50
50
'_source_traceback' , '__weakref__' )
51
51
52
52
def __init__ (self , protocol , transport , loop ,
@@ -78,7 +78,7 @@ def __init__(self, protocol, transport, loop,
78
78
self ._listeners = {}
79
79
self ._log_listeners = set ()
80
80
self ._cancellations = set ()
81
- self ._cleanup_listeners = set ()
81
+ self ._close_listeners = set ()
82
82
83
83
settings = self ._protocol .get_settings ()
84
84
ver_string = settings .server_version
@@ -186,11 +186,11 @@ def add_close_listener(self, callback):
186
186
A callable receiving one argument:
187
187
**connection**: a Connection the callback is registered with.
188
188
"""
189
- self ._cleanup_listeners .add (callback )
189
+ self ._close_listeners .add (callback )
190
190
191
191
def remove_close_listener (self , callback ):
192
192
"""Remove a listening callback for the connection closing."""
193
- self ._cleanup_listeners .discard (callback )
193
+ self ._close_listeners .discard (callback )
194
194
195
195
def get_server_pid (self ):
196
196
"""Return the PID of the Postgres server the connection is bound to."""
@@ -1134,7 +1134,7 @@ def _abort(self):
1134
1134
self ._protocol = None
1135
1135
1136
1136
def _cleanup (self ):
1137
- self ._call_cleanup_listeners ()
1137
+ self ._call_close_listeners ()
1138
1138
# Free the resources associated with this connection.
1139
1139
# This must be called when a connection is terminated.
1140
1140
@@ -1252,12 +1252,12 @@ def _call_log_listener(self, cb, con_ref, message):
1252
1252
'exception' : ex
1253
1253
})
1254
1254
1255
- def _call_cleanup_listeners (self ):
1256
- if not self ._cleanup_listeners :
1255
+ def _call_close_listeners (self ):
1256
+ if not self ._close_listeners :
1257
1257
return
1258
1258
1259
1259
con_ref = self ._unwrap ()
1260
- for cb in self ._cleanup_listeners :
1260
+ for cb in self ._close_listeners :
1261
1261
try :
1262
1262
cb (con_ref )
1263
1263
except Exception as ex :
@@ -1267,7 +1267,7 @@ def _call_cleanup_listeners(self):
1267
1267
'exception' : ex
1268
1268
})
1269
1269
1270
- self ._cleanup_listeners .clear ()
1270
+ self ._close_listeners .clear ()
1271
1271
1272
1272
def _process_notification (self , pid , channel , payload ):
1273
1273
if channel not in self ._listeners :
0 commit comments