Skip to content

fix(diffview): reuse the existing connection for the first diff worker - #8

Merged
nibra180 merged 1 commit into
mainfrom
fix/p2-1-diff-worker-connection
Jul 30, 2026
Merged

fix(diffview): reuse the existing connection for the first diff worker#8
nibra180 merged 1 commit into
mainfrom
fix/p2-1-diff-worker-connection

Conversation

@nibra180

Copy link
Copy Markdown
Contributor

Summary

  • Reuse the established connection for the first diff worker.
  • Make additional FTP worker connections best-effort to support session-limited servers.
  • Add integration-style FTP tests covering single-session and multi-session behavior.
  • Document the completed P2.1 audit item.

Testing

  • go test ./internal/tui/diffview
  • Real in-process FTP server test with one permitted session.
  • Real in-process FTP server test verifying additional worker connections.

forEachCompare opened a fresh connection for every FTP worker, leaving the
already established one unused. On a server that allows only one session per
user browsing worked, but every diff file then failed with a worker connect
error.

The first worker now always runs on the existing connection. Only additional
FTP workers connect on their own and are best-effort: a worker that cannot
connect exits and lowers parallelism instead of failing its jobs. That removes
the connErr channel from compareFunc and simplifies both callers. SFTP keeps
sharing its single pipelined connection across all workers.

Tested against a real in-process FTP server: one allowing a single session
(all files compare cleanly, extra workers still try) and one allowing several
(the pool still grows beyond the first worker).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nibra180
nibra180 merged commit f3e5de4 into main Jul 30, 2026
3 checks passed
@nibra180
nibra180 deleted the fix/p2-1-diff-worker-connection branch July 30, 2026 18:59
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.

1 participant