Skip to content

refactor(pools): share dynamic pool lifecycle - #268

Merged
jerome-benoit merged 1 commit into
masterfrom
port-dynamic-lifecycle
Dec 2, 2026
Merged

jerome-benoit merged 1 commit into
masterfrom
port-dynamic-lifecycle

Conversation

@jerome-benoit

@jerome-benoit jerome-benoit commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What / Why

Port of poolifier/poolifier#3455 (refactor(pool): share dynamic pool lifecycle, final head 15905bb36).

  • Lift the dynamic pool lifecycle from thread/dynamic.ts and thread/fixed.ts into AbstractPool.
  • supportsDynamicWorkers protected getter (default false); DynamicThreadPool overrides it to true.
  • Private #dynamicPoolState (emptyEventEmitted/fullEventEmitted) initialized in the AbstractPool constructor before isMain(); DynamicPoolState interface moves to pools/pool.ts.
  • backPressure, busy and shallCreateDynamicWorker become concrete AbstractPool members using the capacity predicates isDynamicPoolEmpty/isDynamicPoolFull from pools/utils.ts; the prototype/constructor marker machinery is gone.
  • The corresponding *End emission handlers reset the respective flag, as the per-pool fields in thread/dynamic.ts did.

Adaptations to this repo

  • No cluster pool here: the upstream it.each rows for cluster are omitted; thread rows only.
  • pool.info.backPressure is only exposed when enableTasksQueue is enabled in this repo; the construction test asserts the backPressure/busy getters directly, and post-construction info assertions use the fields this repo exposes (maxSize, started).
  • destroy() throws on a non-started pool here; the construction test guards the call with pool.info.started.
  • Test classes use plain fields where upstream TypeScript lowers #private fields: native # field brands are not installed before super() completes in .mjs, which would throw during construction.
  • No ESLint directives (this repo lints with Deno); the explanatory comment about inherited getters before subclass field initialization is kept.

Verification

  • deno fmt --check and deno lint: clean.
  • deno check src/mod.ts: clean.
  • deno test -A tests/: 571 steps pass, 0 failed, 9 ignored (master baseline).

PR Checklist

  • Description, Conventional Commits title, and upstream link.
  • Behavior preserved; existing lifecycle suites cover it.
  • No new features, no API changes.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T00:25:19.314003Z 310e388 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Lift the dynamic pool lifecycle from thread/dynamic.ts and thread/fixed.ts
into AbstractPool: a supportsDynamicWorkers getter gates the private
dynamic pool state that tracks empty/full transitions, capacity predicates
move to pools/utils, and back pressure, busy and growth decisions become
concrete pool members. Fixed pools keep fixed semantics; dynamic pools only
override supportsDynamicWorkers.

Port of poolifier/poolifier#3455.
@jerome-benoit
jerome-benoit force-pushed the port-dynamic-lifecycle branch from acd3061 to 310e388 Compare December 2, 2026 00:24
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@jerome-benoit
jerome-benoit merged commit 3bd8b17 into master Dec 2, 2026
15 checks passed
@jerome-benoit
jerome-benoit deleted the port-dynamic-lifecycle branch December 2, 2026 00:47
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