Skip to content

Commit

Permalink
fix infinite error stream issue
Browse files Browse the repository at this point in the history
It was possible for an SQL error to trigger an infinite loop where SQLPage would stream error messages to the browsers forever
  • Loading branch information
lovasoa committed Jul 26, 2023
1 parent dea7485 commit 18cdb63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webserver/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ pub async fn stream_query_results<'a>(
};
let mut stream = query.fetch_many(connection);
while let Some(elem) = stream.next().await {
yield parse_single_sql_result(elem)
let is_err = elem.is_err();
yield parse_single_sql_result(elem);
if is_err {
break;
}
}
},
ParsedSQLStatement::StaticSimpleSelect(value) => {
Expand Down

0 comments on commit 18cdb63

Please sign in to comment.