Skip to content

Lazy pool initialization

Choose a tag to compare

@LCluber LCluber released this 11 Aug 06:47
· 1 commit to main since this release
  • Lazy pool initialization. pool.ts no longer eagerly constructs the
    pg-pool at module import. The pool is now created on the first call to
    execute() or SQLEntity.query.sync(). The new Pool(...) call is deferred.
  • Fixes zombie boot on init failure. Prior to 0.22.0, the library eagerly
    opened a pg-pool handle that kept Node's event loop alive indefinitely.
    In case of issue the service could log a "cannot start" message then hang
    instead of exiting — because the pool's open handles blocked event-loop drain
    and no signal handler was registered on the boot path. Boot-failure paths are
    now free of antity-pgsql-attributable handles, so process.exitCode = 1
    strategies work again. Consumers using @dwtechs/servpico-express should
    continue to prefer .catch(failFast) for the explicit exit + stderr flush.
  • Declares sideEffects: false. Now that module load is genuinely
    side-effect-free, bundlers can tree-shake unused exports. Consumers that only
    use the query-builder surface (SQLEntity.query.select, filter) without
    ever calling execute() never construct a pool at all.