I don't think this caused any problems for us but you never know ... Release Notes: - N/A *or* Added/Fixed/Improved ...
Unified · Split
| @@ -3,7 +3,6 @@ use std::time::Duration; · 2 unmodified lines | |||
| 3 | use db::kvp::KEY_VALUE_STORE; | 3 | use db::kvp::KEY_VALUE_STORE; |
| 4 | use gpui::{App, AppContext as _, Context, Subscription, Task, WindowId}; | 4 | use gpui::{App, AppContext as _, Context, Subscription, Task, WindowId}; |
| 5 | use util::ResultExt; | 5 | use util::ResultExt; |
| 6 | use uuid::Uuid; | ||
| 7 | 6 | ||
| 8 | pub struct Session { | 7 | pub struct Session { |
| 9 | session_id: String, | 8 | session_id: String, |
| @@ -15,11 +14,9 @@ const SESSION_ID_KEY: &str = "session_id"; · 5 unmodified lines | |||
| 15 | const SESSION_WINDOW_STACK_KEY: &str = "session_window_stack"; | 14 | const SESSION_WINDOW_STACK_KEY: &str = "session_window_stack"; |
| 16 | 15 | ||
| 17 | impl Session { | 16 | impl Session { |
| 18 | pub async fn new() -> Self { | 17 | pub async fn new(session_id: String) -> Self { |
| 19 | let old_session_id = KEY_VALUE_STORE.read_kvp(SESSION_ID_KEY).ok().flatten(); | 18 | let old_session_id = KEY_VALUE_STORE.read_kvp(SESSION_ID_KEY).ok().flatten(); |
| 20 | 19 | ||
| 21 | let session_id = Uuid::new_v4().to_string(); | ||
| 22 | |||
| 23 | KEY_VALUE_STORE | 20 | KEY_VALUE_STORE |
| 24 | .write_kvp(SESSION_ID_KEY.to_string(), session_id.clone()) | 21 | .write_kvp(SESSION_ID_KEY.to_string(), session_id.clone()) |
| 25 | .await | 22 | .await |
| @@ -43,10 +40,10 @@ impl Session { · 17 unmodified lines | |||
| 43 | } | 40 | } |
| 44 | } | 41 | } |
| 45 | 42 | ||
| 46 | // #[cfg(any(test, feature = "test-support"))] | 43 | #[cfg(any(test, feature = "test-support"))] |
| 47 | pub fn test() -> Self { | 44 | pub fn test() -> Self { |
| 48 | Self { | 45 | Self { |
| 49 | session_id: Uuid::new_v4().to_string(), | 46 | session_id: uuid::Uuid::new_v4().to_string(), |
| 50 | old_session_id: None, | 47 | old_session_id: None, |
| 51 | old_window_ids: None, | 48 | old_window_ids: None, |
| 52 | } | 49 | } |
| @@ -287,14 +287,16 @@ pub fn main() { · 286 unmodified lines | |||
| 287 | 287 | ||
| 288 | let app = Application::new().with_assets(Assets); | 288 | let app = Application::new().with_assets(Assets); |
| 289 | 289 | ||
| 290 | let system_id = app.background_executor().block(system_id()).ok(); | 290 | let system_id = app.background_executor().spawn(system_id()); |
| 291 | let installation_id = app.background_executor().block(installation_id()).ok(); | 291 | let installation_id = app.background_executor().spawn(installation_id()); |
| 292 | let session_id = Uuid::new_v4().to_string(); | 292 | let session_id = Uuid::new_v4().to_string(); |
| 293 | let session = app.background_executor().block(Session::new()); | 293 | let session = app |
| 294 | .background_executor() | ||
| 295 | .spawn(Session::new(session_id.clone())); | ||
| 294 | 296 | ||
| 295 | app.background_executor() | 297 | app.background_executor() |
| 296 | .spawn(crashes::init(InitCrashHandler { | 298 | .spawn(crashes::init(InitCrashHandler { |
| 297 | session_id: session_id.clone(), | 299 | session_id, |
| 298 | zed_version: app_version.to_string(), | 300 | zed_version: app_version.to_string(), |
| 299 | binary: "zed".to_string(), | 301 | binary: "zed".to_string(), |
| 300 | release_channel: release_channel::RELEASE_CHANNEL_NAME.clone(), | 302 | release_channel: release_channel::RELEASE_CHANNEL_NAME.clone(), |
| @@ -505,11 +507,16 @@ pub fn main() { · 204 unmodified lines | |||
| 505 | debugger_ui::init(cx); | 507 | debugger_ui::init(cx); |
| 506 | debugger_tools::init(cx); | 508 | debugger_tools::init(cx); |
| 507 | client::init(&client, cx); | 509 | client::init(&client, cx); |
| 510 | |||
| 511 | let system_id = cx.background_executor().block(system_id).ok(); | ||
| 512 | let installation_id = cx.background_executor().block(installation_id).ok(); | ||
| 513 | let session = cx.background_executor().block(session); | ||
| 514 | |||
| 508 | let telemetry = client.telemetry(); | 515 | let telemetry = client.telemetry(); |
| 509 | telemetry.start( | 516 | telemetry.start( |
| 510 | system_id.as_ref().map(|id| id.to_string()), | 517 | system_id.as_ref().map(|id| id.to_string()), |
| 511 | installation_id.as_ref().map(|id| id.to_string()), | 518 | installation_id.as_ref().map(|id| id.to_string()), |
| 512 | session_id.clone(), | 519 | session.id().to_owned(), |
| 513 | cx, | 520 | cx, |
| 514 | ); | 521 | ); |
| 515 | 522 | ||