mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
After closing demo, reuse port if its specified (#3959)
* Reuse port when its specified after closing demo * Add to changelog --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
parent
90f25905d6
commit
7de41d94bb
@ -17,6 +17,7 @@ No changes to highlight.
|
||||
- Fixes type in client `Status` enum by [@10zinten](https://github.com/10zinten) in [PR 3931](https://github.com/gradio-app/gradio/pull/3931)
|
||||
- Fix `gr.ChatBot` to handle image url [tye-singwa](https://github.com/tye-signwa) in [PR 3953](https://github.com/gradio-app/gradio/pull/3953)
|
||||
- Move Google Tag Manager related initialization code to analytics-enabled block by [@akx](https://github.com/akx) in [PR 3956](https://github.com/gradio-app/gradio/pull/3956)
|
||||
- Fix bug where port was not reused if the demo was closed and then re-launched by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3896](https://github.com/gradio-app/gradio/pull/3959)
|
||||
|
||||
## Documentation Changes:
|
||||
|
||||
|
@ -116,6 +116,7 @@ def start_server(
|
||||
else:
|
||||
try:
|
||||
s = socket.socket()
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
s.bind((LOCALHOST_NAME, server_port))
|
||||
s.close()
|
||||
except OSError:
|
||||
|
@ -263,6 +263,16 @@ class TestBlocksMethods:
|
||||
completed = True
|
||||
assert msg["output"]["data"][0] == "Victor"
|
||||
|
||||
def test_socket_reuse(self):
|
||||
|
||||
try:
|
||||
io = gr.Interface(lambda x: x, gr.Textbox(), gr.Textbox())
|
||||
io.launch(server_port=9441, prevent_thread_lock=True)
|
||||
io.close()
|
||||
io.launch(server_port=9441, prevent_thread_lock=True)
|
||||
finally:
|
||||
io.close()
|
||||
|
||||
def test_function_types_documented_in_config(self):
|
||||
def continuous_fn():
|
||||
return 42
|
||||
|
Loading…
Reference in New Issue
Block a user