Skip to content
Snippets Groups Projects
Verified Commit be23f5dc authored by Ole Binder's avatar Ole Binder
Browse files

Fix: allow the preload to time out if the state is None

When the PlayState is None we assume that something went wrong during preloading. If it is None for more than 15 seconds we log an error and stop the preloading. Maybe this logic should be moved into the PlayState itself, which then could set the status to TIMEOUT.
parent 1c0dd740
No related branches found
No related tags found
1 merge request!46Steering playout schema and virtual timeslot integration
......@@ -200,8 +200,9 @@ class PlayCommand(EngineExecutor):
self.logger.info(SU.cyan(f"=== play('{items_str}') ==="))
last_item: PlaylistItem = items[-1]
# FIXME: this never breaks and keeps displaying the message in come faulty edge cases,
# FIXME: this never breaks and keeps displaying the message in some faulty edge cases,
# even after the timeslot ends
timeout = 0
while not last_item.play.is_ready():
now = SU.timestamp()
if now - last_log > log_interval:
......@@ -210,6 +211,21 @@ class PlayCommand(EngineExecutor):
if last_item.play.state == PlayState.PlayStateType.TIMEOUT:
self.logger.warn(SU.red("PLAY: Preloading timed out."))
break
# FIXME: could this be handled inside PlayState which would then set its type to
# TIMEOUT itself?
if last_item.play.state is None:
timeout += 1
else:
timeout = 0
if last_item.play.state is None and timeout >= 15:
self.logger.error(
SU.red(
"PLAY: Aborting preload after 15 seconds since the play state is still None."
)
)
break
self.logger.debug(f"PLAY: STATE({last_item.play.state})")
time.sleep(1)
self.engine.player.play(items[0], engine.Player.TransitionType.FADE)
timetable_renderer: utils.TimetableRenderer = self.engine.scheduler.timetable_renderer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment