Skip to content

fix(lftp): stop overriding Connections settings under FTPS#568

Merged
nitrobass24 merged 1 commit into
developfrom
fix/ftps-respect-connections-settings
Jun 10, 2026
Merged

fix(lftp): stop overriding Connections settings under FTPS#568
nitrobass24 merged 1 commit into
developfrom
fix/ftps-respect-connections-settings

Conversation

@nitrobass24

@nitrobass24 nitrobass24 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

configure_lftp() hard-coded a fixed parallelism profile (parallel-files=4, dir-pget=1, root-pget=4, connection-limit=8) whenever protocol=ftps, silently ignoring the user's Connections settings — the Settings UI showed values that were never applied under FTPS.

This removes the override so the persisted Connections values apply for both protocols. What the UI shows is now what lftp runs.

Why

Empirical throughput testing against a live seedbox (FTPS, ~3.2 GB file, 138 ms RTT) showed the forced profile was not just invisible to the user but actively counterproductive on an aggregate-throttled account:

pget streams throughput
n=1 44.9 MB/s
n=4 41.3 MB/s
n=8 37.3 MB/s

More streams = lower throughput — the signature of a fixed aggregate cap on the seedbox side, where extra connections only add per-stream overhead. SFTP and FTPS hit the same ~45 MB/s ceiling, so the forced FTPS parallelism profile could never help and the user couldn't tune it away because the UI values weren't being applied.

Changes

  • controller/pair_context.py — delete the if cfg.protocol == "ftps": branch; parallelism is taken from persisted Connections settings unconditionally. Docstring updated to explain the removal (and warn against re-adding it).
  • tests/unittests/test_controller/test_pair_context.pytest_ftps_profile_overrides_persisted_sftp_tuningtest_ftps_passes_persisted_values_through. Persisted values (3 / 20 / 20 / 0) are deliberately all distinct from the old profile (4 / 4 / 1 / 8), so asserting they reach lftp proves the override is gone.

Test plan

  • test_pair_context.py — 20/20 pass
  • Full controller unittest suite — 489 pass
  • ruff check — clean
  • ruff format --check — clean
  • Grepped all other protocol == "ftps" sites — all are connection/port/scheme setup (controller.py, lftp.py, validate_config port check); none touch parallelism, so nothing else depended on the forced profile.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • FTPS connections now apply persisted parallelism and connection limit settings instead of using protocol-specific defaults.

configure_lftp() hard-coded a fixed parallelism profile (parallel-files=4,
dir-pget=1, root-pget=4, connection-limit=8) whenever protocol=ftps,
silently ignoring the user's Connections settings — the Settings UI showed
values that were never applied. Empirical throughput testing also showed the
forced profile was slower than a single stream on an aggregate-throttled
seedbox (more streams = lower throughput).

Remove the override so persisted Connections values apply for both
protocols; what the UI shows is now what lftp runs. Flip the pair_context
test to assert FTPS passes persisted values through instead of clobbering them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e2ca3634-0667-4773-8795-2f105f7af26c

📥 Commits

Reviewing files that changed from the base of the PR and between 3257d9d and a6a14e6.

📒 Files selected for processing (2)
  • src/python/controller/pair_context.py
  • src/python/tests/unittests/test_controller/test_pair_context.py

📝 Walkthrough

Walkthrough

The PR simplifies FTPS protocol handling in configure_lftp by removing a fixed profile override. All protocols now uniformly receive parallelism and connection settings directly from persisted configuration, with updated test coverage confirming persisted values pass through unchanged.

Changes

FTPS Protocol Handling Simplification

Layer / File(s) Summary
Remove FTPS override, apply persisted settings uniformly
src/python/controller/pair_context.py, src/python/tests/unittests/test_controller/test_pair_context.py
configure_lftp removes conditional FTPS-specific profile assignment, now assigning num_parallel_jobs, num_parallel_files, num_connections_per_root_file, num_connections_per_dir_file, and num_max_total_connections directly from config.lftp for all protocols. Docstring updated to reflect FTPS no longer ignores persisted settings. Test is replaced: old assertion that FTPS overrides persisted SFTP tuning is removed; new test verifies persisted FTPS values pass through unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • nitrobass24/seedsync#412: Earlier refactor of configure_lftp logic in src/python/controller/pair_context.py that this PR now modifies for FTPS protocol handling.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing an FTPS-specific override that was preventing persisted Connections settings from being applied.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ftps-respect-connections-settings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nitrobass24 nitrobass24 merged commit 1e86386 into develop Jun 10, 2026
18 checks passed
@nitrobass24 nitrobass24 deleted the fix/ftps-respect-connections-settings branch June 10, 2026 14:26
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