Skip to content

Conversation

Copy link

Copilot AI commented Nov 1, 2025

The read() method was missing the None check that read_batch() and read_with_poll() already had, causing vt=0 (immediate visibility) to be incorrectly treated.

Changes

  • pgmq_sqlalchemy/queue.py: Added if vt is None: vt = self.vt check in read() method before passing to internal methods
  • tests/test_queue.py: Added test_send_and_read_msg_with_vt_zero to verify vt=0 behavior

Example

# vt=0 should make message immediately visible
msg_id = pgmq.send(queue_name, {'data': 'value'})
msg = pgmq.read(queue_name, vt=0)  # Now correctly uses 0 seconds

# Can immediately read again
msg = pgmq.read(queue_name)  # Message is visible

Without this fix, vt=0 would be passed directly to internal methods that expect a resolved value, potentially causing incorrect behavior if the code path assumed falsy values should default.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • install.python-poetry.org
    • Triggering command: curl -sSL REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>bug: vt will be set to default vt if provided with 0</issue_title>
<issue_description>- about: visibility timeout will be set to default timeout ( 30 sec ) if vt is provide with 0

  • solution: use check vt is None instead of vt or self.vt</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@jason810496 jason810496 changed the base branch from main to develop November 1, 2025 13:14
Added check for `vt is None` in the read() method to properly handle vt=0.
Previously, vt=0 would be treated as falsy and would default to self.vt (30 seconds).
Now vt=0 correctly sets the visibility timeout to 0 seconds as expected.

Also added test case to verify vt=0 works correctly.

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bug where vt is set to default if provided with 0 Fix vt=0 being ignored in read() method Nov 1, 2025
Copilot AI requested a review from jason810496 November 1, 2025 13:32
Copilot finished work on behalf of jason810496 November 1, 2025 13:32
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.

bug: vt will be set to default vt if provided with 0

2 participants