Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 18 additions & 78 deletions Cargo.Bazel.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "22446b7b142461d94c2d08c9fe4db5d2d9047c00777054093d2d528ed771a456",
"checksum": "8a3d7ef6da26d7dfd4b16144813599eb5c196373b3aa8c3c9ce5fdd998cd6417",
"crates": {
"actix-codec 0.5.1": {
"name": "actix-codec",
Expand Down Expand Up @@ -6378,14 +6378,14 @@
],
"license_file": "LICENSE-APACHE"
},
"backon 0.4.1": {
"backon 1.6.0": {
"name": "backon",
"version": "0.4.1",
"package_url": null,
"version": "1.6.0",
"package_url": "https://github.com/Xuanwo/backon",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/backon/0.4.1/download",
"sha256": "0c1a6197b2120bb2185a267f6515038558b019e92b832bb0320e96d66268dcf9"
"url": "https://static.crates.io/crates/backon/1.6.0/download",
"sha256": "cffb0e931875b666fc4fcb20fee52e9bbd1ef836fd9e9e04ec21555f9f85f7ef"
}
},
"targets": [
Expand All @@ -6407,29 +6407,24 @@
"compile_data_glob": [
"**"
],
"crate_features": {
"common": [
"std",
"std-blocking-sleep"
],
"selects": {}
},
"deps": {
"common": [
{
"id": "fastrand 1.9.0",
"id": "fastrand 2.3.0",
"target": "fastrand"
},
{
"id": "futures-core 0.3.31",
"target": "futures_core"
},
{
"id": "pin-project 1.1.2",
"target": "pin_project"
},
{
"id": "tokio 1.50.0",
"target": "tokio"
}
],
"selects": {}
},
"edition": "2021",
"version": "0.4.1"
"edition": "2024",
"version": "1.6.0"
},
"license": "Apache-2.0",
"license_ids": [
Expand Down Expand Up @@ -21014,11 +21009,7 @@
"target": "axum_server"
},
{
"id": "backoff 0.4.0",
"target": "backoff"
},
{
"id": "backon 0.4.1",
"id": "backon 1.6.0",
"target": "backon"
},
{
Expand Down Expand Up @@ -26270,56 +26261,6 @@
],
"license_file": "LICENSE"
},
"fastrand 1.9.0": {
"name": "fastrand",
"version": "1.9.0",
"package_url": "https://github.com/smol-rs/fastrand",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/fastrand/1.9.0/download",
"sha256": "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
}
},
"targets": [
{
"Library": {
"crate_name": "fastrand",
"crate_root": "src/lib.rs",
"srcs": {
"allow_empty": true,
"include": [
"**/*.rs"
]
}
}
}
],
"library_target_name": "fastrand",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [],
"selects": {
"cfg(all(target_arch = \"wasm32\", not(target_os = \"wasi\")))": [
{
"id": "instant 0.1.12",
"target": "instant"
}
]
}
},
"edition": "2018",
"version": "1.9.0"
},
"license": "Apache-2.0 OR MIT",
"license_ids": [
"Apache-2.0",
"MIT"
],
"license_file": "LICENSE-APACHE"
},
"fastrand 2.3.0": {
"name": "fastrand",
"version": "2.3.0",
Expand Down Expand Up @@ -98503,8 +98444,7 @@
"axum 0.8.9",
"axum-extra 0.10.1",
"axum-server 0.7.3",
"backoff 0.4.0",
"backon 0.4.1",
"backon 1.6.0",
"base32 0.4.0",
"base64 0.13.1",
"bech32 0.9.1",
Expand Down
25 changes: 6 additions & 19 deletions Cargo.Bazel.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1138,14 +1138,11 @@ dependencies = [

[[package]]
name = "backon"
version = "0.4.1"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c1a6197b2120bb2185a267f6515038558b019e92b832bb0320e96d66268dcf9"
checksum = "cffb0e931875b666fc4fcb20fee52e9bbd1ef836fd9e9e04ec21555f9f85f7ef"
dependencies = [
"fastrand 1.9.0",
"futures-core",
"pin-project",
"tokio",
"fastrand",
]

[[package]]
Expand Down Expand Up @@ -3532,7 +3529,6 @@ dependencies = [
"axum 0.8.9",
"axum-extra 0.10.1",
"axum-server 0.7.3",
"backoff",
"backon",
"base32",
"base64 0.13.1",
Expand Down Expand Up @@ -4519,15 +4515,6 @@ dependencies = [
"regex-syntax 0.8.5",
]

[[package]]
name = "fastrand"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]

[[package]]
name = "fastrand"
version = "2.3.0"
Expand Down Expand Up @@ -4841,7 +4828,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c1155db57329dca6d018b61e76b1488ce9a2e5e44028cac420a5898f4fcef63"
dependencies = [
"fastrand 2.3.0",
"fastrand",
"futures-core",
"futures-io",
"memchr",
Expand Down Expand Up @@ -9780,7 +9767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
dependencies = [
"atomic-waker",
"fastrand 2.3.0",
"fastrand",
"futures-io",
]

Expand Down Expand Up @@ -13264,7 +13251,7 @@ version = "3.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
dependencies = [
"fastrand 2.3.0",
"fastrand",
"getrandom 0.3.4",
"once_cell",
"rustix 1.1.4",
Expand Down
25 changes: 17 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ async-trait = "0.1.89"
axum = { version = "0.8.4", features = ["ws"] }
axum-extra = { version = "0.10.1", features = ["typed-header"] }
axum-server = { version = "0.7.2", features = ["tls-rustls-no-provider"] }
backoff = "0.4"
backon = { version = "1.6.0", default-features = false, features = ["std"] }
base64 = { version = "0.13.1" }
bech32 = "^0.9.0"
bincode = "1.3.3"
Expand Down
11 changes: 6 additions & 5 deletions bazel/rust.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ crate.spec(
version = "^0.7.3",
)
crate.spec(
package = "backoff",
version = "^0.4.0",
)
crate.spec(
default_features = False,
features = [
"std",
"std-blocking-sleep",
],
package = "backon",
version = "^0.4.1",
version = "^1.6.0",
)
crate.spec(
package = "base32",
Expand Down
2 changes: 1 addition & 1 deletion packages/pocket-ic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rust_library(
version = "15.0.0",
deps = [
# Keep sorted.
"@crate_index//:backoff",
"@crate_index//:backon",
"@crate_index//:base64",
"@crate_index//:candid",
"@crate_index//:flate2",
Expand Down
2 changes: 1 addition & 1 deletion packages/pocket-ic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ edition.workspace = true
head_nns = []

[dependencies]
backoff = { workspace = true }
backon = { workspace = true }
base64 = { workspace = true }
candid = { workspace = true }
flate2 = { workspace = true }
Expand Down
16 changes: 9 additions & 7 deletions packages/pocket-ic/src/nonblocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use crate::{
CreateCanisterParams, CreateCanisterPlacement, IngressStatusResult, PocketIcBuilder,
PocketIcState, RejectResponse, StartServerParams, TickConfigs, Time, copy_dir, start_server,
};
use backoff::backoff::Backoff;
use backoff::{ExponentialBackoff, ExponentialBackoffBuilder};
use backon::{BackoffBuilder, ExponentialBuilder};
use candid::{
Principal, decode_args, encode_args,
utils::{ArgumentDecoder, ArgumentEncoder},
Expand Down Expand Up @@ -823,16 +822,19 @@ impl PocketIc {
&self,
message_id: RawMessageId,
) -> Result<Vec<u8>, RejectResponse> {
let mut retry_policy: ExponentialBackoff = ExponentialBackoffBuilder::new()
.with_initial_interval(Duration::from_millis(10))
.with_max_interval(Duration::from_secs(1))
.with_multiplier(2.0)
let mut retry_policy = ExponentialBuilder::new()
.with_min_delay(Duration::from_millis(10))
.with_max_delay(Duration::from_secs(1))
.with_factor(2.0)
.with_jitter()
.with_total_delay(Some(Duration::from_secs(15 * 60)))
.without_max_times()
.build();
loop {
if let Some(ingress_status) = self.ingress_status(message_id.clone()).await {
break ingress_status;
}
tokio::time::sleep(retry_policy.next_backoff().unwrap()).await;
tokio::time::sleep(retry_policy.next().unwrap()).await;
}
}

Expand Down
Loading
Loading