Skip to content

Commit

Permalink
perf: change atomic to relaxed
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Dec 4, 2024
1 parent d8fd37c commit 40faca9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/rs-dapi-client/src/dapi_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl DapiRequestExecutor for DapiClient {
// `impl Future<Output = Result<...>`, not a `Result` itself.
let address = address_result.map_err(|inner| ExecutionError {
inner,
retries: retries_counter.load(std::sync::atomic::Ordering::Acquire),
retries: retries_counter.load(std::sync::atomic::Ordering::Relaxed),
address: None,
})?;

Expand All @@ -247,7 +247,7 @@ impl DapiRequestExecutor for DapiClient {
)
.map_err(|error| ExecutionError {
inner: DapiClientError::Transport(error),
retries: retries_counter.load(std::sync::atomic::Ordering::Acquire),
retries: retries_counter.load(std::sync::atomic::Ordering::Relaxed),
address: Some(address.clone()),
})?;

Expand All @@ -256,7 +256,7 @@ impl DapiRequestExecutor for DapiClient {
.await
.map_err(DapiClientError::Transport);

let retries = retries_counter.load(std::sync::atomic::Ordering::Acquire);
let retries = retries_counter.load(std::sync::atomic::Ordering::Relaxed);

let execution_result = result
.map(|inner| {
Expand Down Expand Up @@ -294,7 +294,7 @@ impl DapiRequestExecutor for DapiClient {
.retry(retry_settings)
.notify(|error, duration| {
let retries_counter = Arc::clone(&retries_counter_arc);
retries_counter.fetch_add(1, std::sync::atomic::Ordering::AcqRel);
retries_counter.fetch_add(1, std::sync::atomic::Ordering::Relaxed);

tracing::warn!(
?error,
Expand Down

0 comments on commit 40faca9

Please sign in to comment.