File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -151,15 +151,16 @@ def __enter__(self):
151151 return self
152152
153153 def __exit__ (self , exc_type , exc_val , exc_tb ):
154+ if self .search_obj :
154155 # close elastic search connection
155- self .event_loop .run_until_complete (self .search_obj .es .close ())
156- # close async loop
157- if self .event_loop .is_running () and not self .event_loop .is_closed ():
158- self .event_loop .close ()
159- if exc_type or exc_val or exc_tb :
160- traceback .print_exc ()
161- log .error ("%s %s %s" , exc_val , exc_val , exc_tb )
162- log .exception ("Got an exception" )
156+ self .event_loop .run_until_complete (self .search_obj .es .close ())
157+ # close async loop
158+ if self .event_loop .is_running () and not self .event_loop .is_closed ():
159+ self .event_loop .close ()
160+ if exc_type or exc_val or exc_tb :
161+ traceback .print_exc ()
162+ log .error ("%s %s %s" , exc_val , exc_val , exc_tb )
163+ log .exception ("Got an exception" )
163164
164165 def get_data_format (self ):
165166 """Access method for data_format parameter
You can’t perform that action at this time.
0 commit comments