Skip to content

Fix missing get_db_connection import in queue_manager (silent NameError causes wrongful blacklisting)#426

Open
Ele-CO wants to merge 1 commit into
godver3:mainfrom
Ele-CO:fix/queue-manager-missing-get-db-connection-import
Open

Fix missing get_db_connection import in queue_manager (silent NameError causes wrongful blacklisting)#426
Ele-CO wants to merge 1 commit into
godver3:mainfrom
Ele-CO:fix/queue-manager-missing-get-db-connection-import

Conversation

@Ele-CO

@Ele-CO Ele-CO commented May 30, 2026

Copy link
Copy Markdown

Problem

queues/queue_manager.py calls get_db_connection() in the new-item ghostlist/blacklist pre-check (around line 1115), but get_db_connection is never imported at module level (nor locally in that function).

if imdb_id or tmdb_id:
    conn_check = None
    try:
        conn_check = get_db_connection()   # NameError: name 'get_db_connection' is not defined
        ...

Because the call is inside a try/except, the resulting NameError is swallowed. The pre-check silently fails, which can lead to items being wrongly blacklisted instead of falling back to a 1080p result. The symptom is hard to spot because there's no visible error.

Fix

Add the missing module-level import, matching the existing import style already used throughout the codebase (e.g. database/database_reading.py, database/database_writing.py both do from database.core import get_db_connection).

+from database.core import get_db_connection
 from database.database_writing import update_media_item_state, add_media_item
 from database.database_reading import get_media_item_by_id, get_item_count_by_state
 from database.collected_items import add_to_collected_notifications

This is a one-line, behavior-correcting change. No other logic is touched.

🤖 Generated with Claude Code

queues/queue_manager.py calls get_db_connection() in the new-item
ghostlist/blacklist pre-check (~line 1115) but never imports it at
module level. Because the call sits inside a try/except, the resulting
NameError is swallowed: the pre-check fails silently and items can be
wrongly blacklisted instead of falling back to a 1080p result.

Add the missing module-level import, matching the existing
`from database.core import ...` import style already used across the
codebase (e.g. database_reading.py, database_writing.py). One-line,
behavior-only-corrective change; no other logic touched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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