History

zed: Fix session ID mismatching for workspace and telemetry (#43659)

I don't think this caused any problems for us but you never know ... Release Notes: - N/A *or* Added/Fixed/Improved ...

Lukas Wirth committed 11 months ago

Commit 4e3aa0b1 parent 05764e82 files · +15 −11Browse files

Unified · Split

2 files
  1. crates/session/src/session.rs +3 −6
  2. crates/zed/src/main.rs +12 −5
crates/session/src/session.rs+3−6
@@ -3,7 +3,6 @@ use std::time::Duration; · 2 unmodified lines
33 use db::kvp::KEY_VALUE_STORE;
44 use gpui::{App, AppContext as _, Context, Subscription, Task, WindowId};
55 use util::ResultExt;
6−use uuid::Uuid;
76
87 pub struct Session {
98 session_id: String,
@@ -15,11 +14,9 @@ const SESSION_ID_KEY: &str = "session_id"; · 5 unmodified lines
1514 const SESSION_WINDOW_STACK_KEY: &str = "session_window_stack";
1615
1716 impl Session {
18− pub async fn new() -> Self {
17+ pub async fn new(session_id: String) -> Self {
1918 let old_session_id = KEY_VALUE_STORE.read_kvp(SESSION_ID_KEY).ok().flatten();
2019
21− let session_id = Uuid::new_v4().to_string();
22−
2320 KEY_VALUE_STORE
2421 .write_kvp(SESSION_ID_KEY.to_string(), session_id.clone())
2522 .await
@@ -43,10 +40,10 @@ impl Session { · 17 unmodified lines
4340 }
4441 }
4542
46− // #[cfg(any(test, feature = "test-support"))]
43+ #[cfg(any(test, feature = "test-support"))]
4744 pub fn test() -> Self {
4845 Self {
49− session_id: Uuid::new_v4().to_string(),
46+ session_id: uuid::Uuid::new_v4().to_string(),
5047 old_session_id: None,
5148 old_window_ids: None,
5249 }
crates/zed/src/main.rs+12−5
@@ -287,14 +287,16 @@ pub fn main() { · 286 unmodified lines
287287
288288 let app = Application::new().with_assets(Assets);
289289
290− let system_id = app.background_executor().block(system_id()).ok();
291− let installation_id = app.background_executor().block(installation_id()).ok();
290+ let system_id = app.background_executor().spawn(system_id());
291+ let installation_id = app.background_executor().spawn(installation_id());
292292 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()));
294296
295297 app.background_executor()
296298 .spawn(crashes::init(InitCrashHandler {
297− session_id: session_id.clone(),
299+ session_id,
298300 zed_version: app_version.to_string(),
299301 binary: "zed".to_string(),
300302 release_channel: release_channel::RELEASE_CHANNEL_NAME.clone(),
@@ -505,11 +507,16 @@ pub fn main() { · 204 unmodified lines
505507 debugger_ui::init(cx);
506508 debugger_tools::init(cx);
507509 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+
508515 let telemetry = client.telemetry();
509516 telemetry.start(
510517 system_id.as_ref().map(|id| id.to_string()),
511518 installation_id.as_ref().map(|id| id.to_string()),
512− session_id.clone(),
519+ session.id().to_owned(),
513520 cx,
514521 );
515522

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t