Skip to content

Fix: dedupe task ids before updating to assigned#3818

Open
mrkaye97 wants to merge 5 commits intomainfrom
mk/dedupe-queue-items-to-assign
Open

Fix: dedupe task ids before updating to assigned#3818
mrkaye97 wants to merge 5 commits intomainfrom
mk/dedupe-queue-items-to-assign

Conversation

@mrkaye97
Copy link
Copy Markdown
Contributor

@mrkaye97 mrkaye97 commented May 4, 2026

Description

Seeing a bunch of these:

ERR error marking queue items processed error="ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time (SQLSTATE 21000)

which I think should be resolved by deduping before we do the update here

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Copilot AI review requested due to automatic review settings May 4, 2026 19:19
@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hatchet-docs Ready Ready Preview, Comment May 5, 2026 7:44pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Postgres error (ON CONFLICT DO UPDATE command cannot affect row a second time) by deduplicating task IDs before calling UpdateTasksToAssigned when marking queue items as processed in the scheduler repository.

Changes:

  • Track seen task IDs while building the UpdateTasksToAssigned input arrays.
  • Skip duplicate task IDs to prevent duplicate rows in the UNNEST(...) input that can trigger the ON CONFLICT ... error.

Comment thread pkg/repository/scheduler_queue.go
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.

3 participants