feat: add queue management handlers#1043
Open
ferhatelmas wants to merge 5 commits into
Open
Conversation
Coverage Report for CI Build 29148700684Coverage increased (+0.4%) to 79.824%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
cd05d02 to
8d0e084
Compare
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
8d0e084 to
db8596c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds admin-facing queue overflow management capabilities for pg-boss “created” job backlogs, along with an operator CLI (npm scripts) to list backlog hotspots, archive (“backup”) created jobs into an overflow table, and restore them in controlled batches.
Changes:
- Added
QueueOverflowStorePgwith SQL-backed list/count/backup/restore operations and associated unit/integration tests. - Exposed new admin endpoints under
/queue/overflow,/queue/overflow/count,/queue/overflow/backup, and/queue/overflow/restorewith request schemas and disconnect-aware abort handling. - Added an operator CLI (
jobs-client.ts) + docs and wired npm scripts; refactoredpprof-client.tsto reuse shared integer parsers.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/admin-queue-overflow.test.ts | Integration coverage for admin queue overflow routes against a real pg-boss schema/tables. |
| src/scripts/README.md | Operator documentation for the jobs CLI and endpoint semantics. |
| src/scripts/pprof-client.ts | Reuses shared integer parsing helpers from @internal/parser. |
| src/scripts/jobs-client.ts | New CLI for listing/backing up/restoring created-job overflow via the admin API. |
| src/scripts/jobs-client.test.ts | Unit tests for CLI config parsing, request building, and restore throttling/backoff behavior. |
| src/internal/queue/queue.ts | Moves PG_BOSS_SCHEMA to constants and types Queue.getDb() as QueueDB. |
| src/internal/queue/overflow.ts | New queue overflow store implementing list/count/backup/restore with transactional + advisory-lock semantics. |
| src/internal/queue/overflow.test.ts | Unit tests validating filter normalization, SQL shapes, transaction/abort behavior, and move/restore semantics. |
| src/internal/queue/index.ts | Exports the new overflow module from the queue package. |
| src/internal/queue/database.ts | Adds beginTransaction() to QueueDB to support transactional maintenance operations. |
| src/internal/queue/constants.ts | Adds PG_BOSS_SCHEMA constant to shared queue constants. |
| src/internal/parser/string-list.ts | New helpers for normalizing string lists and parsing comma-separated env/query values. |
| src/internal/parser/string-list.test.ts | Tests for list normalization and comma-separated parsing behavior. |
| src/internal/parser/integer.ts | New strict integer parsers for non-negative and positive safe integers. |
| src/internal/parser/integer.test.ts | Tests for integer parsing strictness and bounds. |
| src/internal/parser/index.ts | Barrel export for new parser utilities. |
| src/internal/parser/boolean.ts | New strict optional-boolean parser used by the jobs CLI. |
| src/internal/parser/boolean.test.ts | Tests for optional-boolean parsing behavior. |
| src/internal/database/pg-connection.ts | Extends beginTransaction options to include abort signals; adds signal-aware pool checkout helper. |
| src/internal/database/pg-connection.test.ts | Tests for signal-aware transaction checkout and late-client release behavior. |
| src/http/routes/admin/queue.ts | Adds admin endpoints + JSON schemas for queue overflow list/count/backup/restore routes. |
| src/http/routes/admin/queue.test.ts | Ensures config initialization order for existing admin queue route tests. |
| package.json | Adds npm scripts for the jobs CLI (list/backup/restore). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
fenos
reviewed
Jul 11, 2026
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
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.
What kind of change does this PR introduce?
feat
What is the current behavior?
Manual queue management under load while jumping between systems.
What is the new behavior?
Admin app attaches endpoints for listing, backup and restore.
Add a client to attach it via npm scripts.
Additional context
Kind of playbook automation/ease of use.
Disabled orioledb for restore due to targetless on conflict incompatibility, that support isn't really needed.