feat: Add multi-queue namespaces and PostgreSQL storage backend#38
Open
feat: Add multi-queue namespaces and PostgreSQL storage backend#38
Conversation
Allow multiple named queues to share a single storage backend. Queue and Reaper accept an optional `name` config, which calls `storage.createNamespace(name)` to get an isolated view. RedisStorage namespaces share the parent's 3 Redis clients with ref-counted connect/disconnect. MemoryStorage returns independent instances. FileStorage uses subdirectories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PgStorage uses SELECT FOR UPDATE SKIP LOCKED for concurrent dequeue (pg-boss pattern) and LISTEN/NOTIFY for pub/sub notifications. Shares pool/listener connections across namespaces with ref counting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add postgres service container for PgStorage tests in CI. Update pnpm-lock.yaml with pg optional dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ShogunPanda
approved these changes
Mar 16, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root connect/disconnect stays idempotent as before. RefCount only tracks namespace children so existing code that calls connect() multiple times followed by a single disconnect() still cleans up. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ShogunPanda
approved these changes
Mar 17, 2026
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.
Summary
createNamespace(name)to theStorageinterface, allowing multiple isolated queues to share a single storage backend. Redis namespaces share the parent's 3 connections with ref-counted connect/disconnect. Memory and File storage create independent instances.PgStorageusingSELECT FOR UPDATE SKIP LOCKEDfor concurrent dequeue (pg-boss pattern) andLISTEN/NOTIFYfor pub/sub notifications. Shares pool/listener across namespaces with ref counting.namefield that automatically creates a namespaced storage view.Test plan
🤖 Generated with Claude Code