fix(geotiff): revert ConcurrencyLimiter to a chunkd SourceMiddleware#572
Merged
Conversation
chunkd#1697 shipped (@chunkd/source 11.4.1, @chunkd/middleware 11.3.1), so SourceView now forwards the request signal to middleware and SourceChunk forwards it on multi-chunk sub-requests. That removes the reason for the LimitedSource source-wrapper workaround (#557): a middleware can now observe an abort, so a request whose caller aborts while queued for a slot is dropped before any network I/O. Replace the internal LimitedSource with LimiterMiddleware again, composed into the header SourceView *after* SourceChunk/SourceCache (so cache hits short-circuit and never burn a slot) and into a tiny SourceView wrapping the data source. Bump the @chunkd/source, @chunkd/source-http, and @chunkd/middleware floors to the fixed releases. Internal-only: GeoTIFF.fromUrl options, ConcurrencyLimiter, Priority, and PerOriginSemaphore are unchanged. The integration test that aborts a queued header read through the real fromUrl -> SourceView -> limiter path is unchanged and still passes, proving the signal now reaches the middleware end to end. Closes #565. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #565.
Summary
chunkd #1697 shipped (
@chunkd/source@11.4.1,@chunkd/middleware@11.3.1), soSourceViewnow forwards the requestsignalto middleware (andSourceChunkforwards it on multi-chunk sub-requests). That removes the reason for theLimitedSourcesource-wrapper workaround introduced in #557: a middleware can now observe an abort, so a request whose caller aborts while queued for a slot is dropped before any network I/O.This reverts the limiter to the originally-intended
LimiterMiddleware(a chunkdSourceMiddleware):limiter.ts—LimitedSource→LimiterMiddleware.geotiff.ts— compose the limiter into the headerSourceViewafterSourceChunk/SourceCache(cache hits short-circuit and never burn a slot), plus a tinySourceViewwrapping the data source.getPrioritythreading preserved.@chunkd/source/@chunkd/source-httpto^11.4.1and@chunkd/middlewareto^11.3.1(the middleware approach hard-requires the fix, so the floors move, not just the lockfile).dev-docs/specs/2026-05-19-concurrency-limiter-design.md.Internal-only: the public API (
GeoTIFF.fromUrloptions,ConcurrencyLimiter,Priority,PerOriginSemaphore) is unchanged either way.Not a blind revert
Two changes landed on
mainafter the original workaround, so a wholesalegit revertwould have dropped them. Both are preserved:normalizePriority(NaN) helper inlimiter.ts, andfromUrl → SourceView → limiterpath.That integration test is the acceptance test for this change — it is unchanged and still passes, which is the end-to-end proof that the signal now reaches the middleware.
Verification
pnpm --filter @developmentseed/geotiff test— 140 passed (16 files)pnpm --filter @developmentseed/geotiff typecheck— cleanpnpm check(biome) — clean🤖 Generated with Claude Code