mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-21 23:18:06 -04:00
fix(volume): preserve DB UUID on cache refresh
When a tracked volume gets updated in the cache (mount status change,
space change, etc.), line 741 was overwriting the ID with existing.id
which could be an ephemeral Uuid::new_v4() if the cache was populated
before DB metadata was merged (startup race condition). This defeats
the stable UUID fix from 4f387eede.
Now prefers the DB UUID from tracked_volumes_map when available,
falling back to existing.id only for untracked volumes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -736,9 +736,12 @@ impl VolumeManager {
|
||||
|| old_info.total_bytes_available != new_info.total_bytes_available
|
||||
|| old_info.error_status != new_info.error_status
|
||||
{
|
||||
// Update the volume - preserve existing ID for cache stability
|
||||
// Update the volume - prefer DB UUID for stability, fall back to cache ID
|
||||
let mut updated_volume = detected.clone();
|
||||
updated_volume.id = existing.id;
|
||||
updated_volume.id = tracked_volumes_map
|
||||
.get(&fingerprint)
|
||||
.map(|(_, db_uuid, ..)| *db_uuid)
|
||||
.unwrap_or(existing.id);
|
||||
updated_volume.update_info(new_info.clone());
|
||||
current_volumes.insert(fingerprint.clone(), updated_volume.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user