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> {
|
) -> Result<M> {
|
||||||
for n in 0..self.client.inner.n_query_retries.saturating_sub(1) {
|
for n in 0..self.client.inner.n_query_retries.saturating_sub(1) {
|
||||||
let res = self
|
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;
|
.await;
|
||||||
let emsg = match res {
|
let emsg = match res {
|
||||||
Ok(res) => return Ok(res),
|
Ok(res) => return Ok(res),
|
||||||
|
|
@ -974,11 +982,14 @@ impl RustyPipeQuery {
|
||||||
|
|
||||||
warn!("{} retry attempt #{}. Error: {}.", operation, n, emsg);
|
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
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Single try of `execute_request_deobf`
|
/// Single try of `execute_request_deobf`
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
async fn _try_execute_request_deobf<
|
async fn _try_execute_request_deobf<
|
||||||
R: DeserializeOwned + MapResponse<M> + Debug,
|
R: DeserializeOwned + MapResponse<M> + Debug,
|
||||||
M,
|
M,
|
||||||
|
|
@ -991,6 +1002,7 @@ impl RustyPipeQuery {
|
||||||
endpoint: &str,
|
endpoint: &str,
|
||||||
body: &B,
|
body: &B,
|
||||||
deobf: Option<&Deobfuscator>,
|
deobf: Option<&Deobfuscator>,
|
||||||
|
report: bool,
|
||||||
) -> Result<M> {
|
) -> Result<M> {
|
||||||
let request = self
|
let request = self
|
||||||
.request_builder(ctype, endpoint)
|
.request_builder(ctype, endpoint)
|
||||||
|
|
@ -1007,6 +1019,7 @@ impl RustyPipeQuery {
|
||||||
let resp_str = response.text().await?;
|
let resp_str = response.text().await?;
|
||||||
|
|
||||||
let create_report = |level: Level, error: Option<String>, msgs: Vec<String>| {
|
let create_report = |level: Level, error: Option<String>, msgs: Vec<String>| {
|
||||||
|
if report {
|
||||||
if let Some(reporter) = &self.client.inner.reporter {
|
if let Some(reporter) = &self.client.inner.reporter {
|
||||||
let report = Report {
|
let report = Report {
|
||||||
info: Default::default(),
|
info: Default::default(),
|
||||||
|
|
@ -1032,6 +1045,7 @@ impl RustyPipeQuery {
|
||||||
|
|
||||||
reporter.report(&report);
|
reporter.report(&report);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if status.is_client_error() || status.is_server_error() {
|
if status.is_client_error() || status.is_server_error() {
|
||||||
|
|
|
||||||
Reference in a new issue