Skip to content

Fix: Only run worker id action getter query when needed#3976

Merged
mrkaye97 merged 9 commits into
mainfrom
mk/workers-fix-2
May 20, 2026
Merged

Fix: Only run worker id action getter query when needed#3976
mrkaye97 merged 9 commits into
mainfrom
mk/workers-fix-2

Conversation

@mrkaye97

Copy link
Copy Markdown
Contributor

Description

Only running GetWorkerActionsByWorkerId when needed (when there are worker ids). Also added another span and some attributes for debugging here.

Type of change

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

Checklist

Changes have been:

  • Tested (unit, integration, or manually with steps specified)
  • Linted and formatted
  • Documented (where applicable)
  • Added to CHANGELOG (where applicable) -- see Keep a Changelog
🤖 AI Disclosure

There was no LLM use in this PR

Copilot AI review requested due to automatic review settings May 20, 2026 20:36
@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hatchet-docs Ready Ready Preview, Comment May 20, 2026 9:19pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the worker repository’s action lookup to avoid querying GetWorkerActionsByWorkerId when there are no worker IDs to look up, and adds tracing to help debug action-resolution behavior in the worker listing/get paths.

Changes:

  • Add an OTel span around WorkerRepository.GetWorkerActionsForWorkers and attach debugging attributes.
  • Only call GetWorkerActionsByWorkerId when workerIds is non-empty.
  • Refactor action mapping logic to build the result map from action-hash lookups first, then worker-id lookups.

Comment thread pkg/repository/worker.go
Comment on lines +321 to +326
if len(recordsFromActionHashes) > 0 {
for _, record := range recordsFromActionHashes {
workerIds, ok := actionHashToWorkerIds[string(record.ActionHash)]

workerIdToActionIds := make(map[string][]string)
if !ok {
continue
@mrkaye97 mrkaye97 requested review from abelanger5 and grutt May 20, 2026 21:12
@mrkaye97 mrkaye97 merged commit df39beb into main May 20, 2026
48 of 52 checks passed
@mrkaye97 mrkaye97 deleted the mk/workers-fix-2 branch May 20, 2026 21:25
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.

4 participants