Skip to content

Conversation

sreya
Copy link
Collaborator

@sreya sreya commented Jun 19, 2025

The test was failing because it was checking for context.Canceled using xerrors.Is, but postgres returns a different error ("pq: canceling statement due to user request") when a query is cancelled. This change uses database.IsQueryCanceledError which properly handles both context.Canceled and postgres-specific cancellation errors.

fixes coder/internal#702

@sreya sreya changed the title fix: handle postgres query cancellation in TestAcquireJobWithCancel_C… fix: flake TestAcquireJobWithCancel_Cancel Jun 19, 2025
@sreya sreya changed the title fix: flake TestAcquireJobWithCancel_Cancel fix: fix TestAcquireJobWithCancel_Cancel flake Jun 19, 2025
@sreya sreya requested a review from deansheather June 19, 2025 02:06
…ancel

The test was failing because it was checking for context.Canceled using
xerrors.Is, but postgres returns a different error ("pq: canceling
statement due to user request") when a query is cancelled. This change
uses database.IsQueryCanceledError which properly handles both
context.Canceled and postgres-specific cancellation errors.
@sreya sreya marked this pull request as ready for review June 19, 2025 02:11
@sreya sreya requested review from kylecarbs and removed request for deansheather June 19, 2025 02:39
@sreya sreya merged commit 8b27983 into main Jun 19, 2025
35 checks passed
@sreya sreya deleted the jon/fixjob branch June 19, 2025 02:51
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: TestAcquireJobWithCancel_Cancel
2 participants