Skip to content

Commit f55d467

Browse files
authored
only send telemetry once (#3325)
1 parent 6a9e2b5 commit f55d467

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/chat-cli/src/cli/user.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ impl LoginArgs {
107107
match start_unified_auth(&mut os.database).await? {
108108
PortalResult::Social(provider) => {
109109
pre_portal_spinner.stop_with_message(format!("Logged in with {provider}"));
110-
os.telemetry.send_user_logged_in().ok();
111110
return Ok(ExitCode::SUCCESS);
112111
},
113112
PortalResult::BuilderId { issuer_url, idc_region } => {
@@ -118,10 +117,6 @@ impl LoginArgs {
118117
PortalResult::AwsIdc { issuer_url, idc_region } => {
119118
pre_portal_spinner.stop_with_message("".into());
120119
info!("Completing AWS Identity Center authentication");
121-
// Save IdC credentials for future use
122-
let _ = os.database.set_start_url(issuer_url.clone());
123-
let _ = os.database.set_idc_region(idc_region.clone());
124-
125120
complete_sso_auth(os, issuer_url, idc_region, true).await?;
126121
},
127122
PortalResult::Internal { issuer_url, idc_region } => {
@@ -200,6 +195,8 @@ impl LoginArgs {
200195
}
201196
}
202197

198+
os.telemetry.send_user_logged_in().ok();
199+
203200
Ok(ExitCode::SUCCESS)
204201
}
205202
}
@@ -231,6 +228,9 @@ async fn complete_sso_auth(os: &mut Os, issuer_url: String, idc_region: String,
231228
os.telemetry.send_user_logged_in().ok();
232229
spinner.stop_with_message("Logged in".into());
233230

231+
let _ = os.database.set_start_url(issuer_url.clone());
232+
let _ = os.database.set_idc_region(idc_region.clone());
233+
234234
// Prompt for profile selection if needed (IdC only)
235235
if requires_profile {
236236
select_profile_interactive(os, true).await?;

0 commit comments

Comments
 (0)