Lower CPU a bit with slower loops.

This commit is contained in:
Matthew Stratford 2021-04-04 23:14:08 +01:00
parent 03773c8dda
commit ccb5886698
4 changed files with 8 additions and 8 deletions

View file

@ -541,7 +541,7 @@ class Player():
try:
while self.running:
time.sleep(0.01)
time.sleep(0.02)
self._updateState()
self._ping_times()
try:

View file

@ -33,7 +33,7 @@ class PlayerHandler():
except:
pass
sleep(0.01)
sleep(0.02)
# Catch the handler being killed externally.
except KeyboardInterrupt:
self.logger.log.info("Received KeyboardInterupt")

View file

@ -343,7 +343,7 @@ def list_showplans():
except queue.Empty:
pass
time.sleep(0.1)
time.sleep(0.02)
@app.route("/library/search/<type>")
def search_library(type: str):
@ -370,7 +370,7 @@ def search_library(type: str):
except queue.Empty:
pass
time.sleep(0.1)
time.sleep(0.02)
@app.route("/library/playlists/<type>")
def get_playlists(type: str):
@ -394,7 +394,7 @@ def get_playlists(type: str):
except queue.Empty:
pass
time.sleep(0.1)
time.sleep(0.02)
@app.route("/library/playlist/<type>/<library_id>")
def get_playlist(type: str, library_id: str):
@ -421,7 +421,7 @@ def get_playlist(type: str, library_id: str):
except queue.Empty:
pass
time.sleep(0.1)
time.sleep(0.02)
@app.route("/plan/load/<int:timeslotid>")
def load_showplan(timeslotid: int):
@ -455,7 +455,7 @@ def status(channel: int):
retries += 1
time.sleep(0.1)
time.sleep(0.02)
@app.route("/quit")

View file

@ -198,7 +198,7 @@ class WebsocketServer:
continue
except Exception as e:
self.logger.log.exception("Exception trying to send to websocket:", e)
await asyncio.sleep(0.01)
await asyncio.sleep(0.02)
self.from_webstudio = asyncio.create_task(handle_from_webstudio())
self.to_webstudio = asyncio.create_task(handle_to_webstudio())