Skip to content

Commit

Permalink
remove duplicate of get_port, refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kreuzert committed Jun 2, 2023
1 parent 5056b1f commit 52b64e6
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions backendspawner/backendspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,12 @@ def get_request_kwargs(self):
""",
).tag(config=True)

port = Integer(
help="""
The port for single-user servers to listen on.
""",
)

@default('port')
def get_port(self):
port = self.custom_port
if callable(port):
port = port()
return port

async def get_port(self):
if callable(self.port):
port = await maybe_future(self.port(self))
if callable(self.custom_port):
port = self.custom_port(self)
else:
port = self.port
port = self.custom_port
return port

poll_interval = Union(
Expand Down Expand Up @@ -455,7 +443,7 @@ async def start(self):
raise e

service_address = self.get_service_address()
port = await self.get_port()
port = self.port
self.log.debug(
f"Expect JupyterLab at {service_address}:{port}",
extra={
Expand Down

0 comments on commit 52b64e6

Please sign in to comment.