Skip to content

Sync calendario: lettura fuori dal main thread, push EventKit raggruppati (#12) - #61

Merged
ivan-94m merged 1 commit into
mainfrom
claude/hopeful-allen-xw7hbr
Oct 6, 2026
Merged

ivan-94m merged 1 commit into
mainfrom
claude/hopeful-allen-xw7hbr

Conversation

@ivan-94m

@ivan-94m ivan-94m commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Seconda parte di #12 (la prima è in #60).

Cosa cambia

  • Import: events(matching:) sulla finestra di 13 mesi gira in un Task.detached (priorità .utility); sul main thread resta solo l'applicazione degli eventi alle task. Store ed eventi passano tra i thread dentro un box @unchecked Sendable (EventKit è thread-safe in lettura; gli EKEvent letti non vengono più toccati sullo sfondo).
  • Export dal funnel touch(): prima c'era un timer e un store.save sincrono per ogni task; ora c'è un solo flush per raffica (400 ms dall'ultimo touch()). Modifiche e rimozioni usano commit: false, seguite da un unico store.commit(). Gli eventi nuovi si salvano subito, perché senza commit non avrebbero l'eventIdentifier e il push successivo creerebbe un doppione.
  • Gli errori di push e rimozione finiscono in lastError (visibile in Impostazioni → Sincronizzazione) invece di sparire in un try? ([P1][Tech-debt] Errori ingoiati in silenzio: 52 try?, 18 assertionFailure, nessun logging #17).

Da verificare

🤖 Generated with Claude Code

https://claude.ai/code/session_01YNpTLZrjEhyL9NsUo5g35L


Generated by Claude Code

…ventKit in un solo commit (#12)

- syncNow: events(matching:) sui 13 mesi in un Task.detached; sul main resta
  solo l'applicazione degli eventi alle task.
- pushIfNeeded: un unico flush per raffica di touch(); modifiche e
  rimozioni con commit: false e un solo store.commit() (gli eventi nuovi si
  salvano subito per avere l'eventIdentifier). Errori in lastError invece
  di try? silenziosi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNpTLZrjEhyL9NsUo5g35L
@ivan-94m
ivan-94m marked this pull request as ready for review October 6, 2026 00:05
@ivan-94m
ivan-94m merged commit 2f0307b into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants