perf(sync): avoid snapshot clone when scheduling uploads
This commit is contained in:
@@ -97,16 +97,7 @@ impl ElyShell {
|
|||||||
let ShellState::Ready(core) = &self.state else {
|
let ShellState::Ready(core) = &self.state else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
let Some(snapshot) = core.snapshot().ok() else {
|
core.cloud_sync_upload_enabled()
|
||||||
return false;
|
|
||||||
};
|
|
||||||
matches!(
|
|
||||||
snapshot.sync_status.connection(),
|
|
||||||
SyncConnectionState::SignedIn
|
|
||||||
| SyncConnectionState::AwaitingDeviceApproval
|
|
||||||
| SyncConnectionState::SyncReady { .. }
|
|
||||||
| SyncConnectionState::SyncError { .. }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inspect the on-disk bearer token and seed `SyncConnectionState`
|
/// Inspect the on-disk bearer token and seed `SyncConnectionState`
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ impl BrowserCore {
|
|||||||
self.sync_connection_state = state;
|
self.sync_connection_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn cloud_sync_upload_enabled(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self.sync_connection_state,
|
||||||
|
SyncConnectionState::SignedIn
|
||||||
|
| SyncConnectionState::AwaitingDeviceApproval
|
||||||
|
| SyncConnectionState::SyncReady { .. }
|
||||||
|
| SyncConnectionState::SyncError { .. }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn sync_space_name_for(&self, space_id: &SpaceId) -> Option<String> {
|
pub(crate) fn sync_space_name_for(&self, space_id: &SpaceId) -> Option<String> {
|
||||||
self.spaces
|
self.spaces
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
Reference in New Issue
Block a user