Skip to content

Optimize relinking of orphaned job host summaries - #1144

Open
ssimpson89 wants to merge 1 commit into
ctrliq:mainfrom
ssimpson89:fix/relink-orphaned-summaries-per-host-update
Open

ssimpson89 wants to merge 1 commit into
ctrliq:mainfrom
ssimpson89:fix/relink-orphaned-summaries-per-host-update

Conversation

@ssimpson89

@ssimpson89 ssimpson89 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Fix per-host UPDATE regression in inventory import relink

Regressed in #577. _relink_orphaned_job_host_summaries() ran one UPDATE per host on every import, even when nothing was orphaned.

It now selects the host names that have orphaned summaries once per batch and only updates those. Which rows get relinked is unchanged.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 23:09

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.

🟡 Changes recommended

The lookup should deduplicate names in the database to prevent memory and transfer costs from growing with matching job history.

1 open issue
What changed in this PR

Optimizes inventory-import relinking introduced in #577 by skipping updates for hosts without orphaned job summaries while preserving the existing relinking filters.

Changes:

  • Queries orphaned host names once per batch and updates only matching hosts.
  • Adds regression tests for batch lookup counts and skipped updates.
File Description
ascender/​main/​tests/​functional/​commands/​test_inventory_import.py Adds query-count and no-orphan regression tests.
ascender/​main/​management/​commands/​inventory_import.py Limits relinking updates to names with orphaned summaries.

Review effort: Balanced

Comment thread ascender/main/management/commands/inventory_import.py Outdated
…s with actual orphans

Signed-off-by: Stephen Simpson <ssimpson89@users.noreply.github.com>
@ssimpson89
ssimpson89 force-pushed the fix/relink-orphaned-summaries-per-host-update branch from 6d4651f to 6aa9f0d Compare October 24, 2026 23:13
Copilot AI balanced review requested due to automatic review settings October 24, 2026 23:13

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.

🟢 Approval recommended

Static review found no blocking issues in the narrowly scoped optimization and regression coverage; tests were not executed.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants