Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
update_loop_task.cancel()
else:
wake_event.set()
logging.info("Woke up")
_, dbus_proto = await jeepney.integrate.asyncio.connect_and_authenticate('SYSTEM')
dbus_bus = jeepney.integrate.asyncio.Proxy(jeepney.bus_messages.message_bus, dbus_proto)
dbus_proto.router.subscribe_signal(
callback=lambda args: prepare_for_sleep(*args),
path='/org/freedesktop/login1',
interface='org.freedesktop.login1.Manager',
member='PrepareForSleep'
)
await dbus_bus.AddMatch(jeepney.bus_messages.MatchRule(
type='signal',
sender='org.freedesktop.login1',
interface='org.freedesktop.login1.Manager',
member='PrepareForSleep',
path='/org/freedesktop/login1'
))
while True:
logging.info("Waiting for wake event")
await wake_event.wait()
logging.info("Starting update loop")
update_loop_task = asyncio.ensure_future(update_loop(config, udev))
try:
await update_loop_task
except asyncio.CancelledError:
logging.info("Stopped update loop")
update_loop_task.cancel()
else:
wake_event.set()
logging.info("Woke up")
_, dbus_proto = await jeepney.integrate.asyncio.connect_and_authenticate('SYSTEM')
dbus_bus = jeepney.integrate.asyncio.Proxy(jeepney.bus_messages.message_bus, dbus_proto)
dbus_proto.router.subscribe_signal(
callback=lambda args: prepare_for_sleep(*args),
path='/org/freedesktop/login1',
interface='org.freedesktop.login1.Manager',
member='PrepareForSleep'
)
await dbus_bus.AddMatch(jeepney.bus_messages.MatchRule(
type='signal',
sender='org.freedesktop.login1',
interface='org.freedesktop.login1.Manager',
member='PrepareForSleep',
path='/org/freedesktop/login1'
))
while True:
logging.info("Waiting for wake event")
await wake_event.wait()
logging.info("Starting update loop")
update_loop_task = asyncio.ensure_future(update_loop(config, udev))
try:
await update_loop_task
except asyncio.CancelledError:
logging.info("Stopped update loop")