async def _sync_service_store(self): store = config_store.fget(self.app) await datastore.check_remote(self.app) await store.read() with store.open() as config: await self._apply_service_config(config)
async def set_user_units(self, units): converter = codec.get_converter(self.app) try: converter.user_units = units with config_store.fget(self.app).open() as config: config[UNIT_CONFIG_KEY] = converter.user_units except InvalidInput as ex: LOGGER.warn(f'Discarding user units due to error: {strex(ex)}') return converter.user_units
def test_main(mocker, app): mocker.patch(TESTED + '.service.run') mocker.patch(TESTED + '.service.create_app').return_value = app main.main() assert None not in [ commander.fget(app), config_store.fget(app), block_store.fget(app), spark.fget(app), mqtt.handler(app), broadcaster.fget(app) ]
def store(app): return config_store.fget(app)
def retry_interval(self, value: float): with config_store.fget(self.app).open() as config: config['retry_interval'] = value self._retry_interval = value
def retry_interval(self) -> float: if not self._retry_interval: with config_store.fget(self.app).open() as config: self._retry_interval = config.get('retry_interval', BASE_RETRY_INTERVAL_S) return self._retry_interval
async def set_autoconnecting(self, enabled): enabled = bool(enabled) service_status.set_autoconnecting(self.app, enabled) with config_store.fget(self.app).open() as config: config[AUTOCONNECTING_KEY] = enabled return enabled