feat: extend sync log with skipped count and bytes transferred

Track how many emails were already up-to-date (skipped) and the
approximate bytes transferred per sync cycle. SyncEmailsResult
accumulates fetched/skipped/bytes across mailboxes; DB schema v11
adds emailsSkipped and bytesTransferred columns to sync_logs.
SyncLogScreen shows "X new · Y up-to-date · took Zs" in the tile
subtitle with full detail rows in the expansion panel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Güttler
2026-04-21 11:32:50 +02:00
co-authored by Claude Sonnet 4.6
parent 0435129434
commit 1ab915d73a
12 changed files with 156 additions and 34 deletions
+7 -1
View File
@@ -133,6 +133,8 @@ class SyncLogs extends Table {
IntColumn get itemsSynced => integer().withDefault(const Constant(0))();
IntColumn get mailboxesSynced => integer().withDefault(const Constant(0))();
IntColumn get pendingFlushed => integer().withDefault(const Constant(0))();
IntColumn get emailsSkipped => integer().withDefault(const Constant(0))();
IntColumn get bytesTransferred => integer().withDefault(const Constant(0))();
DateTimeColumn get startedAt => dateTime()();
DateTimeColumn get finishedAt => dateTime()();
}
@@ -169,7 +171,7 @@ class AppDatabase extends _$AppDatabase {
AppDatabase([QueryExecutor? executor]) : super(executor ?? _openConnection());
@override
int get schemaVersion => 10;
int get schemaVersion => 11;
@override
MigrationStrategy get migration => MigrationStrategy(
@@ -204,6 +206,10 @@ class AppDatabase extends _$AppDatabase {
await m.addColumn(syncLogs, syncLogs.mailboxesSynced);
await m.addColumn(syncLogs, syncLogs.pendingFlushed);
}
if (from < 11) {
await m.addColumn(syncLogs, syncLogs.emailsSkipped);
await m.addColumn(syncLogs, syncLogs.bytesTransferred);
}
},
);
}