Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaswinkler committed Jun 21, 2024
1 parent 20b1935 commit 2486114
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions beetsplug/mbsubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,12 @@ def _start_server(self) -> bool:
return True

if (port := self.create_release_server_port) == 0:
# Find a free port for us to use. The OS will select a random available one.
# We can't pass 0 to waitress.create_server directly, this won't work when
# using hostnames instead of IP addresses for
# create_release_server_hostname, waitress will then bind to multiple
# sockets, with different ports for each.
with socket.socket() as s:
# Find a free port for us to use. The OS will select a random available one.
# We can't pass 0 to waitress.create_server directly, this won't work when
# using hostnames instead of IP addresses for create_release_server_hostname,
# waitress will then bind to multiple sockets, with different ports for each.
s.bind((self.create_release_server_hostname, 0))
port = s.getsockname()[1]

Expand All @@ -359,7 +360,8 @@ def _start_server(self) -> bool:
return True
except (PermissionError, ValueError, OSError) as e:
self._log.error(
f"Failed to start internal web server on {self.create_release_server_hostname}:{port}: {str(e)}"
f"Failed to start internal web server on "
f"{self.create_release_server_hostname}:{port}: {str(e)}"
)
self._server = None
return False
Expand Down

0 comments on commit 2486114

Please sign in to comment.