Skip to content

Commit ee2ce1a

Browse files
committed
Added better cancelation handling
1 parent 5facdae commit ee2ce1a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

redis/auth/token_manager.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def start_async(
161161
block_for_initial: bool = False,
162162
initial_delay_in_ms: float = 0,
163163
skip_initial: bool = False,
164-
) -> Callable[[], Coroutine[Any, Any, None]]:
164+
) -> Callable[[], None]:
165165
self._listener = listener
166166

167167
loop = asyncio.get_running_loop()
@@ -174,15 +174,14 @@ async def start_async(
174174
if block_for_initial:
175175
await init_event.wait()
176176

177-
return self.stop_async
177+
return self.stop
178178

179179
def stop(self):
180+
if self._init_timer is not None:
181+
self._init_timer.cancel()
180182
if self._next_timer is not None:
181183
self._next_timer.cancel()
182184

183-
async def stop_async(self):
184-
return self.stop()
185-
186185
def acquire_token(self, force_refresh=False) -> TokenResponse:
187186
try:
188187
token = self._idp.request_token(force_refresh)

0 commit comments

Comments
 (0)