1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00

GO-1306: Unwatch file if it's synced

This commit is contained in:
Sergey 2023-04-25 18:17:59 +02:00 committed by Mikhail Iudin
parent c64c6054ba
commit 8af40a081a
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0

View file

@ -116,6 +116,10 @@ func (s *statusWatcher) updateFileStatus(ctx context.Context, key fileWithSpace)
if err != nil {
return fmt.Errorf("get file status: %w", err)
}
// Files are immutable, so we can stop watching status updates after file is synced
if status == syncstatus.StatusSynced {
s.Unwatch(key.spaceID, key.fileID)
}
return s.updateReceiver.UpdateTree(context.Background(), key.fileID, status)
}