Skip to content

Commit

Permalink
Fix retry dict conversion (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Nov 21, 2024
1 parent f0dad90 commit 66953d6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 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 obstore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "obstore"
version = "0.3.0-beta.6"
version = "0.3.0-beta.7"
authors = { workspace = true }
edition = { workspace = true }
description = "A Python interface to the Rust object_store crate, providing a uniform API for interacting with object storage services and local files."
Expand Down
2 changes: 2 additions & 0 deletions pyo3-object_store/src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use object_store::{BackoffConfig, RetryConfig};
use pyo3::prelude::*;

#[derive(Debug, FromPyObject)]
#[pyo3(from_item_all)]
pub struct PyBackoffConfig {
init_backoff: Duration,
max_backoff: Duration,
Expand All @@ -21,6 +22,7 @@ impl From<PyBackoffConfig> for BackoffConfig {
}

#[derive(Debug, FromPyObject)]
#[pyo3(from_item_all)]
pub struct PyRetryConfig {
backoff: PyBackoffConfig,
max_retries: usize,
Expand Down
22 changes: 22 additions & 0 deletions tests/test_backoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from datetime import timedelta

from obstore.store import HTTPStore


def test_construction_with_backoff_config():
_store = HTTPStore.from_url(
"https://...",
client_options={
"connect_timeout": "4 seconds",
"timeout": "16 seconds",
},
retry_config={
"max_retries": 10,
"backoff": {
"base": 2,
"init_backoff": timedelta(seconds=1),
"max_backoff": timedelta(seconds=16),
},
"retry_timeout": timedelta(minutes=3),
},
)

0 comments on commit 66953d6

Please sign in to comment.