fix: improve accuracy of rate limit error message in cache API testing and simplify function by removing unused config parameter
parent
2d0cbeaf18
commit
d3179944c0
|
@ -55,7 +55,6 @@ pub async fn test_cache_content_api(
|
||||||
client: Client,
|
client: Client,
|
||||||
api_endpoint: impl IntoUrl,
|
api_endpoint: impl IntoUrl,
|
||||||
validated_key: ValidatedKey,
|
validated_key: ValidatedKey,
|
||||||
config: KeyCheckerConfig,
|
|
||||||
) -> ValidatedKey {
|
) -> ValidatedKey {
|
||||||
let api_endpoint = api_endpoint.into_url().unwrap();
|
let api_endpoint = api_endpoint.into_url().unwrap();
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ pub async fn test_cache_content_api(
|
||||||
&api_endpoint,
|
&api_endpoint,
|
||||||
validated_key.key.clone(),
|
validated_key.key.clone(),
|
||||||
&*CACHE_CONTENT_TEST_BODY,
|
&*CACHE_CONTENT_TEST_BODY,
|
||||||
config.max_retries,
|
1,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
@ -78,7 +77,7 @@ pub async fn test_cache_content_api(
|
||||||
Err(e) => match &e {
|
Err(e) => match &e {
|
||||||
ValidatorError::HttpTooManyRequests { .. } => {
|
ValidatorError::HttpTooManyRequests { .. } => {
|
||||||
debug!(
|
debug!(
|
||||||
"FREE KEY DETECTED - {}... - Cache API not accessible",
|
"FREE KEY DETECTED - {}... - Rate limit exceeded for cache API",
|
||||||
&validated_key.key.as_ref()[..10]
|
&validated_key.key.as_ref()[..10]
|
||||||
);
|
);
|
||||||
validated_key
|
validated_key
|
||||||
|
|
|
@ -61,12 +61,7 @@ impl ValidationService {
|
||||||
.buffer_unordered(self.config.concurrency)
|
.buffer_unordered(self.config.concurrency)
|
||||||
.filter_map(|result| async { result.ok() })
|
.filter_map(|result| async { result.ok() })
|
||||||
.map(|validated_key| {
|
.map(|validated_key| {
|
||||||
test_cache_content_api(
|
test_cache_content_api(self.client.clone(), cache_api_url.clone(), validated_key)
|
||||||
self.client.clone(),
|
|
||||||
cache_api_url.clone(),
|
|
||||||
validated_key,
|
|
||||||
self.config.clone(),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
.buffer_unordered(self.config.concurrency);
|
.buffer_unordered(self.config.concurrency);
|
||||||
pin_mut!(valid_keys_stream);
|
pin_mut!(valid_keys_stream);
|
||||||
|
|
Loading…
Reference in New Issue