Skip to content

Commit

Permalink
Merge pull request #742 from ivyxjc/main
Browse files Browse the repository at this point in the history
return poll status after first load finish
  • Loading branch information
minrk authored Aug 14, 2023
2 parents 56469cb + 67d66ab commit 0e5bb46
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kubespawner/spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,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 @@ -2382,6 +2381,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 @@ -2430,6 +2433,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

0 comments on commit 0e5bb46

Please sign in to comment.