fix: dont create reports on retries
This commit is contained in:
parent
78bf29453f
commit
de9e3c6ed9
1 changed files with 40 additions and 26 deletions
|
|
@ -956,7 +956,15 @@ impl RustyPipeQuery {
|
|||
) -> Result<M> {
|
||||
for n in 0..self.client.inner.n_query_retries.saturating_sub(1) {
|
||||
let res = self
|
||||
._try_execute_request_deobf::<R, M, B>(ctype, operation, id, endpoint, body, deobf)
|
||||
._try_execute_request_deobf::<R, M, B>(
|
||||
ctype,
|
||||
operation,
|
||||
id,
|
||||
endpoint,
|
||||
body,
|
||||
deobf,
|
||||
n == 0,
|
||||
)
|
||||
.await;
|
||||
let emsg = match res {
|
||||
Ok(res) => return Ok(res),
|
||||
|
|
@ -974,11 +982,14 @@ impl RustyPipeQuery {
|
|||
|
||||
warn!("{} retry attempt #{}. Error: {}.", operation, n, emsg);
|
||||
}
|
||||
self._try_execute_request_deobf::<R, M, B>(ctype, operation, id, endpoint, body, deobf)
|
||||
self._try_execute_request_deobf::<R, M, B>(
|
||||
ctype, operation, id, endpoint, body, deobf, false,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Single try of `execute_request_deobf`
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn _try_execute_request_deobf<
|
||||
R: DeserializeOwned + MapResponse<M> + Debug,
|
||||
M,
|
||||
|
|
@ -991,6 +1002,7 @@ impl RustyPipeQuery {
|
|||
endpoint: &str,
|
||||
body: &B,
|
||||
deobf: Option<&Deobfuscator>,
|
||||
report: bool,
|
||||
) -> Result<M> {
|
||||
let request = self
|
||||
.request_builder(ctype, endpoint)
|
||||
|
|
@ -1007,6 +1019,7 @@ impl RustyPipeQuery {
|
|||
let resp_str = response.text().await?;
|
||||
|
||||
let create_report = |level: Level, error: Option<String>, msgs: Vec<String>| {
|
||||
if report {
|
||||
if let Some(reporter) = &self.client.inner.reporter {
|
||||
let report = Report {
|
||||
info: Default::default(),
|
||||
|
|
@ -1032,6 +1045,7 @@ impl RustyPipeQuery {
|
|||
|
||||
reporter.report(&report);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if status.is_client_error() || status.is_server_error() {
|
||||
|
|
|
|||
Reference in a new issue