-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[mob][photos] resolve caption before sync #9102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[mob][photos] resolve caption before sync #9102
Conversation
| e, | ||
| s, | ||
| ); | ||
| await RemoteSyncService.instance.sync(silently: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will wait for upload to finish. For now, either we can ignore this or build api to fetch latest medatada for files that are out of sync
server/pkg/api/file.go
Outdated
|
|
||
| // GetPublicMagicMetadata returns latest public magic metadata for a single file | ||
| // in a given collection if caller has access. | ||
| func (h *FileHandler) GetPublicMagicMetadata(c *gin.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change it to return the File object? We will be able to reuse this API for other cases as well in future if needed.
| if (e.response?.statusCode != 409) { | ||
| rethrow; | ||
| } | ||
|
|
||
| _logger.warning( | ||
| "conflict while syncing public magic metadata, fetching latest metadata and retrying once", | ||
| e, | ||
| s, | ||
| ); | ||
| await _refreshPublicMetadataFromServer(files); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's only try to patch if when only single file is getting updated? For bulk update, this can take way too long if we try to update for each image. Another option is that we create new endpoint for update, and, the new endpoint will return list of fileIDs that are out of sync. If we are just patching for caption, restricting to single file would more sense,
Summary
GET /files/public-magic-metadata?fileID=&collectionID=to return the latest file object for that file+collection (includingpubMagicMetadata) when caller has accessPUT /files/public-magic-metadata, fetch latest data for only the conflicted file(s), refresh local state, and retry onceWhy
Editing caption during/just-after backup can hit metadata version conflicts (409).
Previously the client triggered a full silent sync before retrying, which is expensive.
This changes recovery to a targeted fetch for the specific file+collection and retries once.
Validation
dart formaton changed Dart filesflutter analyze lib/gateways/files/file_magic_gateway.dart lib/services/file_magic_service.dartgofmton changed Go filesgo test ./pkg/api ./pkg/controller ./pkg/repoNotes
go test ./...fails inpkg/repo/storagebonusin local non-test environment with:Not running tests in non-test environment(pre-existing env guard).