Skip to content
Merged
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
4 changes: 2 additions & 2 deletions url_finder/src/api/cache_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn cache_response(state: Arc<AppState>, cache_key: String, response: Respo
Ok(bytes) => bytes,
Err(e) => {
error!("failed to read response body: {:?}", e);
return internal_server_error(format!("Error processing response: {}", e))
return internal_server_error(format!("Error processing response: {e}"))
.into_response();
}
};
Expand All @@ -42,7 +42,7 @@ pub async fn cache_middleware(
) -> Response {
let path = req.uri().path().to_string();
let query = req.uri().query().unwrap_or("").to_string();
let cache_key = format!("cache_{}_{}", path, query);
let cache_key = format!("cache_{path}_{query}");

if let Some(cached_json) = state.cache.get(&cache_key).await {
debug!("cache hit for key: {}", cache_key);
Expand Down
2 changes: 1 addition & 1 deletion url_finder/src/api/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ impl fmt::Display for ErrorCode {
ErrorCode::FailedToGetPeerId => "FailedToGetPeerId",
ErrorCode::FailedToGetDeals => "FailedToGetDeals",
};
write!(f, "{}", s)
write!(f, "{s}")
}
}
4 changes: 2 additions & 2 deletions url_finder/src/cid_contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ impl fmt::Display for CidContactError {
CidContactError::InvalidResponse => "InvalidResponse",
CidContactError::NoData => "NoData",
};
write!(f, "{}", s)
write!(f, "{s}")
}
}

pub async fn get_contact(peer_id: &str) -> Result<serde_json::Value, CidContactError> {
let client = Client::new();
let url = format!("https://cid.contact/providers/{}", peer_id);
let url = format!("https://cid.contact/providers/{peer_id}");

debug!("cid contact url: {:?}", url);

Expand Down
2 changes: 1 addition & 1 deletion url_finder/src/deal_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub async fn get_piece_url(endpoints: Vec<String>, piece_ids: Vec<String>) -> Ve
let endpoint = endpoint.clone();
piece_ids
.iter()
.map(move |piece_id| format!("{}/piece/{}", endpoint, piece_id))
.map(move |piece_id| format!("{endpoint}/piece/{piece_id}"))
})
.collect();

Expand Down
2 changes: 1 addition & 1 deletion url_finder/src/pix_filspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use tracing::debug;
#[allow(dead_code)]
pub async fn get_cid(peer_id: &str, piece_id: &str) -> Result<String> {
let client = Client::new();
let url = format!("https://pix.filspark.com/sample/{}/{}", peer_id, piece_id);
let url = format!("https://pix.filspark.com/sample/{peer_id}/{piece_id}");

debug!("pix filspark url: {:?}", url);

Expand Down
6 changes: 3 additions & 3 deletions url_finder/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn create_routes(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
// more strict rate limiting for the sync routes
let governor_secure = Arc::new(
GovernorConfigBuilder::default()
.per_second(30)
.per_millisecond(30)
.burst_size(30)
.key_extractor(SmartIpKeyExtractor)
.error_handler(too_many_requests_error_handler)
Expand All @@ -44,8 +44,8 @@ pub fn create_routes(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
// less strict rate limiting for the async routes that will have internal queue anyway
let governor_async = Arc::new(
GovernorConfigBuilder::default()
.per_second(30)
.burst_size(10)
.per_millisecond(30)
.burst_size(30)
.key_extractor(SmartIpKeyExtractor)
.error_handler(too_many_requests_error_handler)
.finish()
Expand Down