Invoke __identity_connected__ for sql http requests#2826
Closed
Invoke __identity_connected__ for sql http requests#2826
Conversation
coolreader18
requested changes
Jun 4, 2025
Comment on lines
+413
to
+458
| .leader(database.id) | ||
| .await | ||
| .map_err(log_and_500)? | ||
| .ok_or(StatusCode::NOT_FOUND)?; | ||
| let json = host.exec_sql(auth, database, body).await?; | ||
| let json = leader.exec_sql(auth, database, body).await?; | ||
|
|
||
| let total_duration = json.iter().fold(0, |acc, x| acc + x.total_duration_micros); | ||
|
|
||
| call_on_disconnect(module, connection_id, caller_identity).await?; | ||
|
|
Collaborator
There was a problem hiding this comment.
You shouldn't ? on the result from exec_sql until after you call call_on_disconnect; otherwise, if the query fails for any reason, the module will never know that the client has disconnected. probably want something like
let json_result = exec_sql.await;
let disconn_result = call_on_disconnect.await;
let json = json_result?;
disconn_result?;But that precise order of a sql error taking precedence over an on_disconnect error probably doesn't matter too much
94b95fe to
5a43886
Compare
dfd8eb1 to
44ce625
Compare
Collaborator
|
Superseded by #4563 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Closes #2802
We invoke identity_connected for reducer calls over http but not for sql. This is a problem since identity_connected can have access control logic.
API and ABI breaking changes
Minor: It will run the
on_connect and on_disconnectso in could reject calls that before run.Expected complexity level and risk
1
Testing