File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -175,20 +175,21 @@ def __update_availability(self, available: bool):
175175 task_to_start = None
176176
177177 self .__lock .lock ()
178- if available == self . __last_available :
179- self .__lock . unlock ()
180- return
178+ try :
179+ if available == self .__last_available :
180+ return
181181
182- state_changed = True
183- self .__last_available = available
182+ state_changed = True
183+ self .__last_available = available
184184
185- if available :
186- poller_to_stop = self .__poller
187- self .__poller = None
188- elif self .__poller is None :
189- task_to_start = RepeatingTask ("ldclient.check-availability" , 0.5 , 0 , self .__check_availability )
190- self .__poller = task_to_start
191- self .__lock .unlock ()
185+ if available :
186+ poller_to_stop = self .__poller
187+ self .__poller = None
188+ elif self .__poller is None :
189+ task_to_start = RepeatingTask ("ldclient.check-availability" , 0.5 , 0 , self .__check_availability )
190+ self .__poller = task_to_start
191+ finally :
192+ self .__lock .unlock ()
192193
193194 if available :
194195 log .warning ("Persistent store is available again" )
You can’t perform that action at this time.
0 commit comments