Compare commits
3 Commits
0933f943a5
...
91b40234cb
Author | SHA1 | Date | |
---|---|---|---|
|
91b40234cb | ||
|
91621847e5 | ||
|
8e8d5cd36a |
5
Makefile
5
Makefile
@ -10,4 +10,7 @@ pub: build
|
||||
install:
|
||||
pip install -e .[dev,pub]
|
||||
|
||||
.PHONY: build clean pub install
|
||||
test-api:
|
||||
docker run --rm -ti -p 4999:4999 python:3.7-slim bash -c "pip install announce_server==0.0.2rc2; pip install 'python-socketsio[asyncio_client]==5.0'; announce_server start_registry"
|
||||
|
||||
.PHONY: build clean pub install test-api
|
@ -73,8 +73,8 @@ To start the registry server with the default configuration, run:
|
||||
announce_server start_registry
|
||||
```
|
||||
|
||||
To start the registry server with a custom IP address, port number, heartbeat interval, and timeout, run:
|
||||
The full syntax is equivalent to:
|
||||
|
||||
```bash
|
||||
announce_server start_registry --address localhost --port 4998 --heartbeat_interval 10 --heartbeat_timeout 5
|
||||
announce_server start_registry --address 0.0.0.0 --port 4999 --heartbeat_interval 5 --heartbeat_timeout 3
|
||||
```
|
@ -12,7 +12,6 @@ classifiers =
|
||||
Intended Audience :: Developers
|
||||
License :: OSI Approved :: MIT License
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
@ -24,7 +23,7 @@ package_dir =
|
||||
= src
|
||||
packages = find:
|
||||
install_requires =
|
||||
python-socketio[asyncio_client]
|
||||
python-socketio[asyncio_client]~=5.0.0
|
||||
|
||||
[options.packages.find]
|
||||
where = src
|
||||
|
2
setup.py
2
setup.py
@ -7,5 +7,5 @@ setup(
|
||||
"setuptools_scm",
|
||||
],
|
||||
use_scm_version=True,
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7", # because of python-socketsio[asyncio_client]
|
||||
)
|
||||
|
@ -137,10 +137,18 @@ def start_server(address, port, heartbeat_interval, heartbeat_timeout):
|
||||
The timeout for waiting for a response in seconds.
|
||||
"""
|
||||
loop = asyncio.get_event_loop()
|
||||
heartbeat_task = loop.create_task(
|
||||
# Python 3.7+, coroutines only:
|
||||
# heartbeat_task = loop.create_task(
|
||||
# heartbeat(sio, heartbeat_interval, heartbeat_timeout)
|
||||
# )
|
||||
# aiohttp_app = loop.create_task(web._run_app(app, host=address, port=port))
|
||||
|
||||
# Python 3.6+ compatible. Supports any awaitable:
|
||||
heartbeat_task = asyncio.ensure_future(
|
||||
heartbeat(sio, heartbeat_interval, heartbeat_timeout)
|
||||
)
|
||||
aiohttp_app = loop.create_task(web._run_app(app, host=address, port=port))
|
||||
|
||||
aiohttp_app = asyncio.ensure_future(web._run_app(app, host=address, port=port))
|
||||
|
||||
exit_handler = create_exit_handler(loop, heartbeat_task)
|
||||
signal.signal(signal.SIGINT, exit_handler)
|
||||
|
Loading…
Reference in New Issue
Block a user