Skip to content
Permalink
Browse files
Handle ntp sync in audioservice ready wait
Events (any python threading in general) don't use monotonic time and
can be affected by an ntp sync.

This replaces the normal event with the MonotonicEvent class handling jumps
into the future.
  • Loading branch information
forslund committed Sep 10, 2020
1 parent fc3d8ce commit 4e7809d732f7e3d24b4a69cb8f449759e2264468
Showing 1 changed file with 3 additions and 3 deletions.
@@ -17,11 +17,12 @@
import time
from os import listdir
from os.path import abspath, dirname, basename, isdir, join
from threading import Lock, Event
from threading import Lock

from mycroft.configuration import Configuration
from mycroft.messagebus.message import Message
from mycroft.util.log import LOG
from mycroft.util.monotonic_event import MonotonicEvent

from .services import RemoteAudioBackend

@@ -152,7 +153,7 @@ def __init__(self, bus):
self.play_start_time = 0
self.volume_is_low = False

self._loaded = Event()
self._loaded = MonotonicEvent()
bus.once('open', self.load_services_callback)

def load_services_callback(self):
@@ -161,7 +162,6 @@ def load_services_callback(self):
service and default and registers the event handlers for the
subsystem.
"""

services = load_services(self.config, self.bus)
# Sort services so local services are checked first
local = [s for s in services if not isinstance(s, RemoteAudioBackend)]

0 comments on commit 4e7809d

Please sign in to comment.