fix: batch PR status fetching to prevent memory spikes#101
Merged
Conversation
Previously, the app was spawning processes for every task on every tick: - loadTasks() spawned goroutines calling CheckPRStateAndUpdateTask for each task with a branch (doing git fetch + PR checks) every 1 second - fetchAllPRInfo() spawned separate `gh pr view` calls for every task when cache expired (every 30 seconds) With 10+ tasks, this caused bursts of 10+ gh processes (~40MB each) plus git fetch calls, leading to memory spikes that could exhaust system memory and cause Claude instances to OOM. Changes: - Add FetchAllPRsForRepo() that fetches all PRs for a repo in a single `gh pr list` call instead of N individual `gh pr view` calls - Replace per-task PR fetching with batch refreshAllPRs() that groups tasks by repo and fetches sequentially (avoiding memory spikes) - Add dedicated 30-second prRefreshTick instead of checking on every tick - Remove per-task CheckPRStateAndUpdateTask goroutine spam from loadTasks() Also: make --host, --port, --local flags persistent so they work on subcommands Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ghandgitprocessesFetchAllPRsForRepo()for batch PR fetching via singlegh pr listcallrefreshAllPRs()on 30-second timer--host,--port,--localflags persistent for subcommandsTest plan
tasks -land monitor memory usage - should see no more spikes of multipleghprocesses🤖 Generated with Claude Code