File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -665,10 +665,13 @@ def close(self, error=None):
665
665
will be failed with this exception.
666
666
Default: kafka.errors.ConnectionError.
667
667
"""
668
+ if self .state is ConnectionStates .DISCONNECTED :
669
+ if error is not None :
670
+ log .warning ('%s: Duplicate close() with error: %s' , self , error )
671
+ return
668
672
log .info ('%s: Closing connection. %s' , self , error or '' )
669
- if self .state is not ConnectionStates .DISCONNECTED :
670
- self .state = ConnectionStates .DISCONNECTING
671
- self .config ['state_change_callback' ](self )
673
+ self .state = ConnectionStates .DISCONNECTING
674
+ self .config ['state_change_callback' ](self )
672
675
self ._update_reconnect_backoff ()
673
676
self ._close_socket ()
674
677
self .state = ConnectionStates .DISCONNECTED
You can’t perform that action at this time.
0 commit comments