Skip to content

Commit

Permalink
RetryOptions::custom should take Arc<T> where T: RetryPolicy + Policy (
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev authored Sep 2, 2022
1 parent ebbe6dc commit 69ee7c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sdk/core/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ impl RetryOptions {
}

/// A custom retry using the supplied retry policy.
pub fn custom<T: RetryPolicy + Debug + Send + Sync + 'static>(policy: T) -> Self {
pub fn custom<T: RetryPolicy + 'static>(policy: Arc<T>) -> Self {
Self {
mode: RetryMode::Custom(Arc::new(policy)),
mode: RetryMode::Custom(policy),
}
}

Expand Down
4 changes: 2 additions & 2 deletions sdk/core/src/policies/retry_policies/retry_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::time::Duration;
/// `wait` can be implemented in more complex cases where a simple test of time
/// is not enough.
#[async_trait]
pub trait RetryPolicy: Sync {
pub trait RetryPolicy: std::fmt::Debug + Send + Sync {
/// Determine if no more retries should be performed.
///
/// Must return true if no more retries should be attempted.
Expand Down Expand Up @@ -48,7 +48,7 @@ const RETRY_STATUSES: &[StatusCode] = &[
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
impl<T> Policy for T
where
T: RetryPolicy + std::fmt::Debug + Send + Sync,
T: RetryPolicy,
{
async fn send(
&self,
Expand Down

0 comments on commit 69ee7c5

Please sign in to comment.