more refactors and logs page handling

This commit is contained in:
shenlong-tanwen
2024-10-23 02:30:46 +05:30
parent 8f47645cdb
commit a0afea04d8
90 changed files with 2386 additions and 584 deletions
@@ -51,9 +51,9 @@ class AssetSyncService with LogMixin {
);
final assetsFromServer = await syncApiRepo.getFullSyncForUser(
lastId: lastAssetId,
limit: chunkSize,
updatedUntil: updatedTill,
lastId: lastAssetId,
userId: user.id,
);
if (assetsFromServer == null) {
@@ -92,8 +92,8 @@ class AssetSyncService with LogMixin {
final (toAdd, toUpdate, toRemove) = await _diffAssets(
newAssets,
existingAssets,
compare: compare,
isRemoteSync: isRemoteSync,
compare: compare,
);
final assetsToAdd = toAdd.followedBy(toUpdate);
@@ -111,7 +111,7 @@ class AssetSyncService with LogMixin {
}) async {
// fast paths for trivial cases: reduces memory usage during initial sync etc.
if (newAssets.isEmpty && inDb.isEmpty) {
return const (<Asset>[], <Asset>[], <Asset>[]);
return (<Asset>[], <Asset>[], <Asset>[]);
} else if (newAssets.isEmpty && isRemoteSync == null) {
// remove all from database
return (const <Asset>[], const <Asset>[], inDb);