Repository navigation
fix: keep concurrency 0 so it disables the limit as documented - #364
Open
theluckystrike wants to merge 1 commit into
Open
theluckystrike wants to merge 1 commit into
theluckystrike wants to merge 1 commit into
Conversation
expandConfig used `concurrency || 20`, so the documented value 0 became the default of 20. Use `??` so only a missing value takes the default. The local sqlite3 pool turned 0 into 1 connection, so it now treats 0 as no connection limit. Fixes tursodatabase#351
This branch has not been deployed
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.
Fixes #351.
Config.concurrencyis documented as "set it to 0 to disable concurrency limits completely", butexpandConfigdid:0 || 20is 20, soconcurrency: 0silently became the default limit.Changes:
packages/libsql-core/src/config.ts: useconcurrency ?? 20, so only a missing value takes the default. Negative values still clamp to 0.packages/libsql-client/src/sqlite3.ts: the local file pool usedMath.max(1, config.concurrency). Before this change it never saw 0, but with the fix above 0 would have shrunk the pool from 20 connections to 1. It now treats 0 as no connection limit, the same as the HTTP and WebSocket clients, wherepromise-limitalready treats 0 as pass-through. In-memory databases and embedded replicas keep their single connection.config.test.ts: four cases forconcurrency(default, custom, 0, negative). The 0 case fails on main (expected 0, received 20) and passes with the fix.Tests run:
config.test.tsanduri.test.ts(36 passed),npm run typecheck,npm run format:check. I also opened 25 read transactions on a local file client: withconcurrency: 0all 25 open, with the default the 21st getsTRANSACTION_ACTIVEas before, and withconcurrency: 2the 3rd does.This takes the same direction as #359, which its author closed without review.