Skip to content

Commit ec05865

Browse files
committed
replaced blocking thread sleeps
1 parent c2f878a commit ec05865

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aerospike-core/src/commands/batch_read_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
use std::collections::HashMap;
1616
use std::sync::Arc;
17-
use std::thread;
1817
use std::time::{Duration, Instant};
1918

2019
use crate::cluster::Node;
@@ -23,6 +22,7 @@ use crate::errors::{ErrorKind, Result, ResultExt};
2322
use crate::net::Connection;
2423
use crate::policy::{BatchPolicy, Policy, PolicyLike};
2524
use crate::{value, BatchRead, Record, ResultCode, Value};
25+
use aerospike_rt::sleep;
2626

2727
struct BatchRecord {
2828
batch_index: usize,
@@ -69,7 +69,7 @@ impl BatchReadCommand {
6969
// Sleep before trying again, after the first iteration
7070
if iterations > 1 {
7171
if let Some(sleep_between_retries) = base_policy.sleep_between_retries() {
72-
thread::sleep(sleep_between_retries);
72+
sleep(sleep_between_retries).await;
7373
}
7474
}
7575

aerospike-core/src/commands/single_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
use std::sync::Arc;
16-
use std::thread;
1716
use std::time::Instant;
1817

1918
use crate::cluster::partition::Partition;
@@ -23,6 +22,7 @@ use crate::errors::{ErrorKind, Result, ResultExt};
2322
use crate::net::Connection;
2423
use crate::policy::Policy;
2524
use crate::Key;
25+
use aerospike_rt::sleep;
2626

2727
pub struct SingleCommand<'a> {
2828
cluster: Arc<Cluster>,
@@ -89,7 +89,7 @@ impl<'a> SingleCommand<'a> {
8989
// Sleep before trying again, after the first iteration
9090
if iterations > 1 {
9191
if let Some(sleep_between_retries) = policy.sleep_between_retries() {
92-
thread::sleep(sleep_between_retries);
92+
sleep(sleep_between_retries).await;
9393
}
9494
}
9595

0 commit comments

Comments
 (0)