Skip to content

fix: match fixed capacity to the allocated storage - #18

Open
feritcemkahraman wants to merge 1 commit into
mourner:mainfrom
feritcemkahraman:fix/allocated-fixed-capacity
Open

feritcemkahraman wants to merge 1 commit into
mourner:mainfrom
feritcemkahraman:fix/allocated-fixed-capacity

Conversation

@feritcemkahraman

Copy link
Copy Markdown

A fixed queue created with capacity 1.5 allocates one slot, but keeps 1.5 as its capacity. After the first push, the overflow check never matches; another push can lose the queued item. A capacity of 0.5 similarly allocates no storage yet accepts a push.

Use the allocated ID array length as the fixed capacity, matching the typed array constructor's length conversion. Dynamic queues keep their infinite capacity.

Validation: both new regression tests failed before the fix. npm test passes ESLint, TypeScript declaration generation and all 7 tests afterward (Node 24). git diff --check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant