Skip to content

Commit

Permalink
Improvement: add console redirect timeout warning (#9985)
Browse files Browse the repository at this point in the history
## Problem

There is no information on session being cancelled in 2 minutes at the
moment

## Summary of changes

The timeout being logged for the user
  • Loading branch information
luixo authored Dec 3, 2024
1 parent f312c65 commit 3baef0b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions proxy/src/auth/backend/console_redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ impl ReportableError for ConsoleRedirectError {
}
}

fn hello_message(redirect_uri: &reqwest::Url, session_id: &str) -> String {
fn hello_message(
redirect_uri: &reqwest::Url,
session_id: &str,
duration: std::time::Duration,
) -> String {
let formatted_duration = humantime::format_duration(duration).to_string();
format!(
concat![
"Welcome to Neon!\n",
"Authenticate by visiting:\n",
"Authenticate by visiting (will expire in {duration}):\n",
" {redirect_uri}{session_id}\n\n",
],
duration = formatted_duration,
redirect_uri = redirect_uri,
session_id = session_id,
)
Expand Down Expand Up @@ -118,7 +124,11 @@ async fn authenticate(
};

let span = info_span!("console_redirect", psql_session_id = &psql_session_id);
let greeting = hello_message(link_uri, &psql_session_id);
let greeting = hello_message(
link_uri,
&psql_session_id,
auth_config.console_redirect_confirmation_timeout,
);

// Give user a URL to spawn a new database.
info!(parent: &span, "sending the auth URL to the user");
Expand Down

1 comment on commit 3baef0b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7144 tests run: 6826 passed, 0 failed, 318 skipped (full report)


Flaky tests (4)

Postgres 17

Postgres 16

Postgres 14

Code coverage* (full report)

  • functions: 30.8% (8261 of 26837 functions)
  • lines: 47.8% (65156 of 136223 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
3baef0b at 2024-12-03T20:54:35.080Z :recycle:

Please sign in to comment.