Skip to content

Conversation

zackpollard
Copy link
Member

@zackpollard zackpollard commented Aug 4, 2025

Fixes #20458

Fixes an issue with setTimeout not actually waiting the 2ms we were asking it to. It turns out that when used with such small values it may or may not actually wait that long. In 1,000 runs, setTimeout(2) would consistently have a few instances where it waited less than 1ms, resulting in flaky medium tests which rely on the database query happening at least 1ms after the last insert/update.

@zackpollard zackpollard marked this pull request as draft August 5, 2025 00:02
@zackpollard zackpollard force-pushed the fix/album-asset-new-asset-sync branch from 6cf750a to 5fcd42d Compare August 5, 2025 10:25
@zackpollard zackpollard force-pushed the fix/album-asset-new-asset-sync branch from 5fcd42d to 9bd86cd Compare August 5, 2025 10:27
@zackpollard zackpollard marked this pull request as ready for review August 5, 2025 10:35
@zackpollard zackpollard force-pushed the fix/album-asset-new-asset-sync branch from 33bce32 to 94c57dc Compare August 5, 2025 12:41
@@ -139,14 +139,18 @@ class SyncStreamService {
return _syncStreamRepository.updateAlbumUsersV1(data.cast(), debugLabel: 'backfill');
case SyncEntityType.albumUserDeleteV1:
return _syncStreamRepository.deleteAlbumUsersV1(data.cast());
case SyncEntityType.albumAssetV1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this down to the section of TO BE REMOVED so that the user can keep using the v1.137.x if they haven't updated yet

Copy link
Member Author

@zackpollard zackpollard Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how much I want to maintain backwards compatibility for the beta timeline, doing this means we need to keep the types in the server there so they are generated too. I would just put a note that says albums on beta timeline need you to update to continue working. We have enough to be doing without maintaining compatibility 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not finished syncing because the type is missing

I/flutter (13374): Parsed JSON: {type: AlbumAssetV1, data: {id: 55d2791a-8a08-4ea4-bc28-d36af78a8f6a, ownerId: 7f9087b2-3f6e-4b08-9b8f-f16999c3c89d, originalFileName: IMG_0212.HEIC, fileCreatedAt: 2023-05-02T16:24:05.655Z, fileModifiedAt: 2023-05-02T17:54:47.000Z, localDateTime: 2023-05-02T11:24:05.655Z, type: IMAGE, deletedAt: null, isFavorite: false, visibility: timeline, duration: null, livePhotoVideoId: null, stackId: null, libraryId: null, checksum: PYzuD7wsJJgedORkz9gAu5Qsa3Y=, thumbhash: HfgJBQBTiH+Wpofnh3hoiNw/AckI}, ack: AlbumAssetV1|01983305-99a0-74c9-a39a-6a76da61eae0}
I/flutter (13374): [SEVERE] [2025-08-05 09:42:55.456653] [SyncApiRepository] Error processing stream
I/flutter (13374): Error: Null check operator used on a null value
I/flutter (13374): Stack: #0      SyncApiRepository._parseLines (package:immich_mobile/infrastructure/repositories/sync_api.repository.dart:119:61)

Copy link
Member

@alextran1502 alextran1502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and worked well, although it is breaking when connecting to instance v1.137.x and v1.136.x

@zackpollard zackpollard merged commit 0238134 into main Aug 5, 2025
58 of 59 checks passed
@zackpollard zackpollard deleted the fix/album-asset-new-asset-sync branch August 5, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[beta] Albums fail to sync with foreign key constraint failure
3 participants