refactor: better error handling

This commit is contained in:
zhom
2026-02-16 13:50:18 +04:00
parent bb8356eeef
commit 59706e62c1
7 changed files with 212 additions and 46 deletions
+17
View File
@@ -1146,6 +1146,23 @@ pub async fn set_profile_sync_enabled(
);
}
// Report updated sync-enabled profile count to the cloud backend
if crate::cloud_auth::CLOUD_AUTH.is_logged_in().await {
let sync_count = profile_manager
.list_profiles()
.map(|profiles| profiles.iter().filter(|p| p.sync_enabled).count())
.unwrap_or(0);
tokio::spawn(async move {
if let Err(e) = crate::cloud_auth::CLOUD_AUTH
.report_sync_profile_count(sync_count as i64)
.await
{
log::warn!("Failed to report sync profile count: {e}");
}
});
}
Ok(())
}