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

fix: update max shards values #29

Merged
merged 1 commit into from
Mar 29, 2023
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 src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export function withCarCids (handler) {
if (!ctx.dataCid) throw new Error('missing data CID')
if (!ctx.searchParams) throw new Error('missing URL search params')

// Cloudflare currently sets a limit of 1000 sub-requests within the worker context
// Cloudflare currently sets a limit of 3300 sub-requests within the worker context
// If we have a given root CID splitted across hundreds of CARs, freeway will hit
// the sub-requests limit and not serve content anyway
const maxShards = env.MAX_SHARDS ? parseInt(env.MAX_SHARDS) : 250
const maxShards = env.MAX_SHARDS ? parseInt(env.MAX_SHARDS) : 825

const carCids = ctx.searchParams.getAll('origin').flatMap(str => {
return str.split(',')
Expand Down
4 changes: 2 additions & 2 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ r2_buckets = [
command = "npm run build"

[env.production.vars]
MAX_SHARDS = "250"
MAX_SHARDS = "825"

# Staging!
[env.staging]
Expand All @@ -44,7 +44,7 @@ r2_buckets = [
command = "npm run build"

[env.staging.vars]
MAX_SHARDS = "250"
MAX_SHARDS = "825"

# Test!
[env.test]
Expand Down