Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,17 @@ impl SyncService {
async fn perform_sync(&self) -> Result<SyncStatus> {
info!("🔄 Starting sync process...");

// Fetch projects from backend
let projects = match self.get_backend().await?.fetch_projects().await {
// One backend, four requests in flight at once. Each arm below keeps its own error
// handling, sections included: it degrades to an empty Vec instead of failing the sync.
let backend = self.get_backend().await?;
let (projects, tasks, labels, sections) = tokio::join!(
backend.fetch_projects(),
backend.fetch_tasks(),
backend.fetch_labels(),
backend.fetch_sections(),
);

let projects = match projects {
Ok(projects) => {
info!("✅ Fetched {} projects from backend", projects.len());
projects
Expand All @@ -220,8 +229,7 @@ impl SyncService {
}
};

// Fetch all tasks from backend
let tasks = match self.get_backend().await?.fetch_tasks().await {
let tasks = match tasks {
Ok(tasks) => {
info!("✅ Fetched {} tasks from backend", tasks.len());
tasks
Expand All @@ -234,8 +242,7 @@ impl SyncService {
}
};

// Fetch all labels from backend
let labels = match self.get_backend().await?.fetch_labels().await {
let labels = match labels {
Ok(labels) => {
info!("✅ Fetched {} labels from backend", labels.len());
labels
Expand All @@ -248,8 +255,7 @@ impl SyncService {
}
};

// Fetch all sections from backend
let sections = match self.get_backend().await?.fetch_sections().await {
let sections = match sections {
Ok(sections) => {
info!("✅ Fetched {} sections from backend", sections.len());
sections
Expand Down
Loading