Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return poll status after first load finish #742

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion kubespawner/spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,6 @@ async def poll(self):
necessary to check that the returned value is None, rather than
just Falsy, to determine that the pod is still running.
"""

await self._start_watching_pods()

ref_key = f"{self.namespace}/{self.pod_name}"
Expand Down Expand Up @@ -2356,6 +2355,10 @@ async def _start_reflector(

if previous_reflector and not replace:
# fast path
if not previous_reflector.first_load_future.done():
# make sure it's loaded, so subsequent calls to start_reflector
# don't finish before the first
await previous_reflector.first_load_future
return previous_reflector

if self.enable_user_namespaces:
Expand Down Expand Up @@ -2404,6 +2407,9 @@ async def catch_reflector_start(func):
# we replaced the reflector, stop the old one
asyncio.ensure_future(previous_reflector.stop())

# wait for first load
await current_reflector.first_load_future

# return the current reflector
return current_reflector

Expand Down