Skip to content

perf(argocd-wait-sync-multi): refresh and poll apps in parallel - #400

Merged
JesperTerkelsen merged 1 commit into
mainfrom
perf/argocd-wait-multi-parallel-polls
Nov 12, 2026
Merged

JesperTerkelsen merged 1 commit into
mainfrom
perf/argocd-wait-multi-parallel-polls

Conversation

@JesperTerkelsen

Copy link
Copy Markdown
Member

Summary

argocd-wait-sync-multi runs argocd app get once per app, one after another (~2.6s per call). That happens both for the up-front refresh and on every poll. On monorepo-typescript's production deploys (up to 18 apps):

  • the refresh takes ~47s before the first poll. Run 43057813743: the wait step starts at 16:41:18 and the first status prints at 16:42:05.
  • a poll sweep takes 15–25s, so an app's end timestamp (wall clock when it is first seen healthy) is late by up to one sweep. That timing goes straight into the #info-releases changelog.

Changes

  • The initial refresh runs every app's argocd app get --refresh in the background and then waits.
  • Each poll first fetches every unfinished app's status in parallel into a temp dir (cleaned up on EXIT), then runs the existing per-app state machine on those results. The state machine is unchanged.
  • README and CLAUDE.md change log updated.

The rarely hit in-loop calls (the ComparisonError hard refresh, error-message fetches and the supersede gh api compare) stay sequential.

Test plan

  • test/run-tests.sh: 5/5 pass (the fixture path goes through the new parallel fetch)
  • Fake argocd that sleeps 1s per call, 10 healthy apps: 23s → 3s
  • shellcheck: no new findings (the remaining SC2004 style notes are on existing lines)
  • First monorepo-typescript production deploy after merge: the wait step shows the first status within a few seconds of starting

Callers use this action @main; only monorepo-typescript uses it today, and the change is behaviour-preserving apart from timing.

🤖 Generated with Claude Code

The initial refresh and every poll ran `argocd app get` once per app,
sequentially (~2.6s each). For monorepo-typescript's 18-app deploys the
refresh took ~47s before the first poll and each poll sweep 15-25s, so
the recorded per-app `end` was late by up to a sweep.

Both now background each app's call and `wait`; the state machine reads
the fetched status from a temp dir and is otherwise unchanged. With a
1s fake argocd and 10 healthy apps the script runs in 3s instead of 23s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@JesperTerkelsen
JesperTerkelsen marked this pull request as ready for review November 11, 2026 23:53
@JesperTerkelsen
JesperTerkelsen requested a review from a team as a code owner November 11, 2026 23:53
@JesperTerkelsen
JesperTerkelsen requested review from prasad-manu and removed request for a team November 11, 2026 23:53
@JesperTerkelsen
JesperTerkelsen merged commit bb79ede into main Nov 12, 2026
1 check passed
@JesperTerkelsen
JesperTerkelsen deleted the perf/argocd-wait-multi-parallel-polls branch November 12, 2026 09:42
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.

2 participants