mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-14 02:43:19 +03:00
Add feedback for telemetry item when there's no data
This commit is contained in:
parent
74b10e4ba5
commit
9398de6a57
@ -577,8 +577,13 @@ fn open_telemetry_log_file(
|
|||||||
workspace.with_local_workspace(&app_state.clone(), cx, move |_, cx| {
|
workspace.with_local_workspace(&app_state.clone(), cx, move |_, cx| {
|
||||||
cx.spawn_weak(|workspace, mut cx| async move {
|
cx.spawn_weak(|workspace, mut cx| async move {
|
||||||
let workspace = workspace.upgrade(&cx)?;
|
let workspace = workspace.upgrade(&cx)?;
|
||||||
|
|
||||||
|
async fn fetch_log_string(app_state: &Arc<AppState>) -> Option<String> {
|
||||||
let path = app_state.client.telemetry_log_file_path()?;
|
let path = app_state.client.telemetry_log_file_path()?;
|
||||||
let log = app_state.fs.load(&path).await.log_err()?;
|
app_state.fs.load(&path).await.log_err()
|
||||||
|
}
|
||||||
|
|
||||||
|
let log = fetch_log_string(&app_state).await.unwrap_or_else(|| "// No data has been collected yet".to_string());
|
||||||
|
|
||||||
const MAX_TELEMETRY_LOG_LEN: usize = 5 * 1024 * 1024;
|
const MAX_TELEMETRY_LOG_LEN: usize = 5 * 1024 * 1024;
|
||||||
let mut start_offset = log.len().saturating_sub(MAX_TELEMETRY_LOG_LEN);
|
let mut start_offset = log.len().saturating_sub(MAX_TELEMETRY_LOG_LEN);
|
||||||
|
Loading…
Reference in New Issue
Block a user