Dev - #22
Merged
Merged
Conversation
…s in Pool - release() now invokes the callback even when the resource isn't in the pool or is already idle, instead of silently dropping it (releaseAsync() could hang forever otherwise). - close() now rejects any requests still queued instead of discarding them without ever calling back. - _houseKeep() no longer marks the pool CLOSED while a resource creation is still in flight, which was leaking a never-destroyed resource. - _ensureMin() skips scheduling a process.nextTick() entirely when min/minIdle are both unset (the default), removing a wasted microtask on every single acquire(). - _createResource()/_processNextRequest() properly account for _creating and _requestsProcessing when a request has already timed out, instead of leaking both counters. - awaitResult() replaces putil-promisify's promisify.await() on the create/destroy/reset/validate paths, attaching both handlers via .then(onFulfilled, onRejected) instead of chaining a second promise off .catch() - one fewer Promise allocated per call.
Ad hoc benchmark-tests/ script (untyped one-shot loop, no repeats, no statistics) replaced with a real harness modeled after postgrejs's own benchmark tool: - One child process per (library, scenario, run), spawned sequentially, using tinybench for latency/throughput sampling. - 5 scenarios (acquire-release, acquire-release-concurrent, queue-contention, create-destroy-churn, validate-on-borrow) comparing lightning-pool against generic-pool on an identical simulated resource. - GC/peak-heap instrumentation via node:perf_hooks + --expose-gc, with a periodic forced setImmediate yield (installPeriodicYield in worker.ts) so a pool whose hot path resolves entirely through microtasks doesn't read back as a misleading gcCount=0/peakHeap=0. - `npm run bench` (matrix runner, --lib/--scenario/--repeats flags) and `npm run bench:report` (regenerate the doc from existing results).
…KS.md
README.md was ~80% API reference (methods/properties/events/enums), pushing
the actual pitch and quick-start below the fold. That reference now lives in
doc/API.md, corrected against the current source along the way:
- Removed `resetOnReturn`, an option that no longer exists.
- Removed acquire()'s `factoryCreateOptions` parameter, which doesn't exist
either - factory.create(info) is populated by the Pool itself on retries.
- Fixed the `create-error` event name to `error` (payload:
{requestTime, tries, maxRetries}).
- Documented releaseAsync()/destroyAsync()/closeAsync(), the `terminate` and
`request-timeout` events, and the exported ResourceState enum - none of
which were mentioned before.
doc/BENCHMARKS.md is benchmark/report/render-markdown.ts's generated output,
committed so README.md's link to it resolves to real numbers; regenerate
with `npm run bench` or `npm run bench:report`.
The stale root BANCHMARK.md (describing the now-removed benchmark-tests/
tool) is removed - superseded by doc/BENCHMARKS.md.
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.
No description provided.