Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs: Remove concurrency limit, rely on rate limit #4570

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 2 additions & 3 deletions core/src/polling_monitor/ipfs_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn ipfs_service(
client: IpfsClient,
max_file_size: u64,
timeout: Duration,
concurrency_and_rate_limit: u16,
rate_limit: u16,
) -> IpfsService {
let ipfs = IpfsServiceInner {
client,
Expand All @@ -26,8 +26,7 @@ pub fn ipfs_service(
};

let svc = ServiceBuilder::new()
.rate_limit(concurrency_and_rate_limit.into(), Duration::from_secs(1))
.concurrency_limit(concurrency_and_rate_limit as usize)
.rate_limit(rate_limit.into(), Duration::from_secs(1))
.service_fn(move |req| ipfs.cheap_clone().call_inner(req))
.boxed();

Expand Down
2 changes: 2 additions & 0 deletions core/src/polling_monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ where

// Object not found, push the id to the back of the queue.
Ok((id, None)) => {
debug!(logger, "not found on polling"; "object_id" => id.to_string());

metrics.not_found.inc();
queue.push_back(id);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ those.
may use (in bytes, defaults to 256MB).
- `GRAPH_MAX_IPFS_CACHE_SIZE`: maximum number of files cached (defaults to 50).
- `GRAPH_MAX_IPFS_CACHE_FILE_SIZE`: maximum size of each cached file (in bytes, defaults to 1MiB).
- `GRAPH_IPFS_REQUEST_LIMIT`: Limits both concurrent and per second requests to IPFS for file data
sources. Defaults to 100.
- `GRAPH_IPFS_REQUEST_LIMIT`: Limits both per second requests to IPFS for file data sources.
Defaults to 100.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better: 'Limits the number of requests per second to IPFS for ...'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


## GraphQL

Expand Down
2 changes: 1 addition & 1 deletion graph/src/env/mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct EnvVarsMapping {
/// bytes). Defaults to 256 MiB.
pub max_ipfs_file_bytes: usize,

/// Limits both concurrent and per second requests to IPFS for file data sources.
/// Limits per second requests to IPFS for file data sources.
///
/// Set by the environment variable `GRAPH_IPFS_REQUEST_LIMIT`. Defaults to 100.
pub ipfs_request_limit: u16,
Expand Down