Skip to content

fix(QueueDepthChecker): respect queue.connections.<name>.connection - #70

Open
django23 wants to merge 2 commits into
storviaio:mainfrom
django23:fix/queue-depth-respect-connection
Open

fix(QueueDepthChecker): respect queue.connections.<name>.connection#70
django23 wants to merge 2 commits into
storviaio:mainfrom
django23:fix/queue-depth-respect-connection

Conversation

@django23

@django23 django23 commented May 19, 2026

Copy link
Copy Markdown

Problem

QueueDepthChecker::getDatabaseQueueDepth() uses DB::table(), which queries the app's default DB connection.

When the database queue driver is configured against a non-default connection; e.g. a dedicated SQLite file via DB_QUEUE_DATABASE, or a separate MySQL host; the depth check hits the wrong database and throws SQLSTATE[HY000]: General error: 1 no such table: jobs, flooding logs whenever the dashboard or its polling endpoint is open.

Fix

Resolve the queue-specific connection (falling back to database.default) and route all four queries through DB::connection(\$dbConnection)->table(...).

$dbConnection = config("queue.connections.{\$connection}.connection", config('database.default'));
\$query = DB::connection(\$dbConnection)->table(\$table)->...

Same pattern already used in Laravel's own DatabaseQueue driver.

Repro

config/queue.php:

'database' => [
    'driver'     => 'database',
    'connection' => 'queue_sqlite', // separate connection
    'table'      => 'jobs',
],

Open the Vantage dashboard → logs flood every poll cycle. After this PR: clean.

django23 added 2 commits May 19, 2026 22:06
`getDatabaseQueueDepth()` used `DB::table()`, which queries the app's
default DB connection. When the queue uses the `database` driver against
a non-default connection (e.g. a dedicated SQLite file via
DB_QUEUE_DATABASE, or a separate MySQL host), the check hits the wrong
database and throws "no such table: jobs", flooding logs whenever the
dashboard or its polling endpoint is open.

Resolve the queue-specific connection (falling back to
`database.default`) and route all four queries through
`DB::connection($dbConnection)->table(...)`.
Two regression tests that fail against the pre-fix code with
"no such table: jobs", and pass after the fix:

1. Queue uses `database` driver with a `connection` set to a separate
   in-memory SQLite, and `jobs` only exists there. Asserts depths come
   back correctly for both queues.
2. Same setup, filtered by a specific queue name.
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