fix(cosmic-config): attempt to reconnect to the settings daemon

This commit is contained in:
Ashley Wulber 2024-05-12 14:17:43 -04:00 committed by Michael Murphy
parent 3cfc5c16a3
commit 6a97435263
5 changed files with 114 additions and 28 deletions

View file

@ -71,20 +71,18 @@ async fn start_listening<
match state {
ConfigState::Init(config_id, version, is_state) => {
let (tx, rx) = mpsc::channel(100);
let config = match if is_state {
let Ok(config) = (if is_state {
Config::new_state(&config_id, version)
} else {
Config::new(&config_id, version)
} {
Ok(c) => c,
Err(_) => return ConfigState::Failed,
}) else {
return ConfigState::Failed;
};
let watcher = match config.watch(move |_helper, keys| {
let Ok(watcher) = config.watch(move |_helper, keys| {
let mut tx = tx.clone();
let _ = tx.try_send(keys.to_vec());
}) {
Ok(w) => w,
Err(_) => return ConfigState::Failed,
}) else {
return ConfigState::Failed;
};
match T::get_entry(&config) {
@ -115,7 +113,7 @@ async fn start_listening<
if !changed.is_empty() {
_ = output
.send(crate::Update {
errors: errors,
errors,
keys: changed,
config: conf_data.clone(),
})