Skip to content

perf(client): build multipart body once before polling loop#36

Merged
greynewell merged 1 commit intomainfrom
claude/issue-33-20260227-0311
Feb 27, 2026
Merged

perf(client): build multipart body once before polling loop#36
greynewell merged 1 commit intomainfrom
claude/issue-33-20260227-0311

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Feb 27, 2026

Summary

  • Moves multipart body construction out of the polling loop in both GetGraph and GetCircularDependencies
  • The repo zip is now serialized into a []byte once before the loop; each poll attempt resets the reader with bytes.NewReader(bodyBytes) instead of re-allocating and re-copying the full zip
  • Eliminates up to ~900 MB of redundant data copies across 90 poll retries for a 10 MB repo zip

Changes

  • internal/api/client.go: Extracted multipart body construction (including project_name field and file form-file) before the for attempt loop in both GetGraph (was lines 284-297) and GetCircularDependencies (was lines 416-428). Each loop iteration now calls bytes.NewReader(bodyBytes) to supply a fresh reader to http.NewRequestWithContext.

Fixes #33

Generated with Claude Code

Avoid re-serializing the entire repo zip on every poll retry in both
GetGraph and GetCircularDependencies. The multipart body is now built
once before the loop and re-used via bytes.NewReader on each attempt,
eliminating up to 900 MB of redundant copies across 90 poll retries
with a 10 MB zip.

Fixes #33

Co-Authored-By: Grey Newell <greynewell@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@greynewell greynewell merged commit faa6ba6 into main Feb 27, 2026
1 check passed
@greynewell greynewell deleted the claude/issue-33-20260227-0311 branch February 27, 2026 03:20
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.

perf: multipart body rebuilt from scratch on every poll retry, re-serializing full zip each time

1 participant