prevent while loop using 100% cpu

This commit is contained in:
Ali Abid 2021-06-24 13:04:38 -07:00
parent 47118e62a3
commit 1afbca27e0
2 changed files with 10 additions and 4 deletions

View File

@ -411,8 +411,8 @@ class Interface:
def run_until_interrupted(self, thread, path_to_local_server):
try:
while 1:
pass
while True:
time.sleep(0.5)
except (KeyboardInterrupt, OSError):
print("Keyboard interruption in main thread... closing server.")
thread.keep_running = False

View File

@ -6,7 +6,7 @@ old_version=$(grep -Po "(?<=version=')[^']+(?=')" setup.py)
echo "Current version is $old_version. New version?"
read new_version
sed -i "s/version='$old_version'/version='$new_version'/g" setup.py
echo $new_version > gradio/version.txt
read -p "npm build? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
@ -15,7 +15,13 @@ then
cd ..
fi
aws s3 cp gradio/frontend s3://gradio/$new_version/ --recursive
read -p "frontend updates? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
aws s3 cp gradio/frontend s3://gradio/$new_version/ --recursive
echo $new_version > gradio/version.txt
fi
rm -r dist/*
rm -r build/*
python setup.py sdist bdist_wheel