Skip to content

Commit

Permalink
chore: code style optimization for timeout retry (#9927)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcy-fdu authored May 22, 2023
1 parent d9483f6 commit c2a3a1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/meta/src/storage/etcd_retry_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::iter::{Map, Take};
use std::time::Duration;

use etcd_client::{
Expand Down Expand Up @@ -40,7 +39,7 @@ impl EtcdRetryClient {
}

#[inline(always)]
fn get_retry_strategy() -> Map<Take<ExponentialBackoff>, fn(Duration) -> Duration> {
fn get_retry_strategy() -> impl Iterator<Item = Duration> {
ExponentialBackoff::from_millis(DEFAULT_RETRY_INTERVAL)
.max_delay(DEFAULT_RETRY_MAX_DELAY)
.take(DEFAULT_RETRY_MAX_ATTEMPTS)
Expand Down
3 changes: 1 addition & 2 deletions src/object_store/src/object/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use std::cmp;
use std::iter::{Map, Take};
use std::sync::Arc;
use std::time::Duration;

Expand Down Expand Up @@ -728,7 +727,7 @@ impl S3ObjectStore {
}

#[inline(always)]
fn get_retry_strategy() -> Map<Take<ExponentialBackoff>, fn(Duration) -> Duration> {
fn get_retry_strategy() -> impl Iterator<Item = Duration> {
ExponentialBackoff::from_millis(DEFAULT_RETRY_INTERVAL)
.max_delay(DEFAULT_RETRY_MAX_DELAY)
.take(DEFAULT_RETRY_MAX_ATTEMPTS)
Expand Down

0 comments on commit c2a3a1f

Please sign in to comment.