File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
packages/service-library/src/servicelib/redis Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -207,16 +207,17 @@ async def acquire(self) -> bool:
207207 ttl_seconds = int (self .ttl .total_seconds ())
208208
209209 try :
210- stop_condition = stop_after_delay (0 ) # non-blocking by default
211- if self .blocking :
212- stop_condition = (
213- stop_after_delay (self .blocking_timeout )
214- if self .blocking_timeout
215- else stop_never
216- )
217210
218211 @retry (
219- stop = stop_condition ,
212+ stop = (
213+ stop_after_delay (0 )
214+ if not self .blocking
215+ else (
216+ stop_after_delay (self .blocking_timeout )
217+ if self .blocking_timeout
218+ else stop_never
219+ )
220+ ),
220221 wait = wait_random_exponential (min = 0.1 ),
221222 retry = retry_if_exception_type (redis .exceptions .TimeoutError ),
222223 )
@@ -373,7 +374,7 @@ async def reacquire(self) -> None:
373374
374375 async def is_acquired (self ) -> bool :
375376 """Check if the semaphore is currently acquired by this instance."""
376- return (
377+ return bool (
377378 await handle_redis_returns_union_types (
378379 self .redis_client .redis .exists (self .holder_key )
379380 )
You can’t perform that action at this time.
0 commit comments