mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 22:24:17 +01:00
quick fixes 4
This commit is contained in:
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
@@ -61,15 +61,16 @@ jobs:
|
|||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@v4"
|
- uses: "actions/checkout@v4"
|
||||||
|
- run: "pipx install poetry"
|
||||||
- uses: "actions/setup-python@v5"
|
- uses: "actions/setup-python@v5"
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
cache: "pip"
|
cache: "poetry"
|
||||||
- run: "cd example && pip install $(cat requirements.txt)"
|
- run: "SKIP_BUILD_FRONTEND=true poetry install"
|
||||||
- run: "cd example && python object.py"
|
- run: "PYTHONPATH=yacv_server YACV_STOP_EARLY=true poetry run python example/object.py"
|
||||||
- run: "mv example/export/object.glb example/export/example.glb"
|
- run: "mv export/object.glb export/example.glb"
|
||||||
- uses: "actions/upload-artifact@v4"
|
- uses: "actions/upload-artifact@v4"
|
||||||
with:
|
with:
|
||||||
name: "example"
|
name: "example"
|
||||||
path: "example/export"
|
path: "export"
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
@@ -126,20 +126,21 @@ class Server:
|
|||||||
print('Cannot stop server because it is not running')
|
print('Cannot stop server because it is not running')
|
||||||
return
|
return
|
||||||
|
|
||||||
# Make sure we can hold the lock for more than 100ms (to avoid exiting too early)
|
if os.getenv('YACV_STOP_EARLY', '') == '':
|
||||||
logger.info('Stopping server (waiting for at least one frontend request first, cancel with CTRL+C)...')
|
# Make sure we can hold the lock for more than 100ms (to avoid exiting too early)
|
||||||
try:
|
logger.info('Stopping server (waiting for at least one frontend request first, cancel with CTRL+C)...')
|
||||||
while not self.at_least_one_client.is_set():
|
try:
|
||||||
time.sleep(0.01)
|
while not self.at_least_one_client.is_set():
|
||||||
except KeyboardInterrupt:
|
time.sleep(0.01)
|
||||||
pass
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
logger.info('Stopping server (waiting for no more frontend requests)...')
|
logger.info('Stopping server (waiting for no more frontend requests)...')
|
||||||
acquired = time.time()
|
acquired = time.time()
|
||||||
while time.time() - acquired < 1.0:
|
while time.time() - acquired < 1.0:
|
||||||
if self.frontend_lock.locked():
|
if self.frontend_lock.locked():
|
||||||
acquired = time.time()
|
acquired = time.time()
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
# Stop the server in the background
|
# Stop the server in the background
|
||||||
self.loop.call_soon_threadsafe(lambda *a: self.do_shutdown.set())
|
self.loop.call_soon_threadsafe(lambda *a: self.do_shutdown.set())
|
||||||
|
|||||||
Reference in New Issue
Block a user