Skip to content

feat: Create and reuse existing session #94

Merged
monstermuffin merged 4 commits intomainfrom
qbit-session
Apr 10, 2026
Merged

feat: Create and reuse existing session #94
monstermuffin merged 4 commits intomainfrom
qbit-session

Conversation

@monstermuffin
Copy link
Copy Markdown
Owner

This fixes #87, qSticky currently creates a new qBittorrent session every poll interval, which causes repeated /api/v2/auth/login requests and noisy qBittorrent logs. This change keeps the existing Gluetun behavior but removes the unnecessary qB logins.

Reuse the qBittorrent aiohttp session between poll cycles instead of creating a new session and logging in on every check.

Changes

  • Keep a persistent qBittorrent aiohttp.ClientSession for the lifetime of qSticky.
  • Track qBittorrent auth state so login only happens when needed.
  • Retry once by recreating the qB session after auth loss or connection failure.
  • Route qB preference reads and port updates through the shared request flow.
  • Update the Docker build workflow so the qbit-session branch is built for testing.

@monstermuffin monstermuffin linked an issue Apr 7, 2026 that may be closed by this pull request
@monstermuffin monstermuffin merged commit cbeb5e4 into main Apr 10, 2026
2 checks passed
@monstermuffin monstermuffin deleted the qbit-session branch April 10, 2026 10:30
@monstermuffin
Copy link
Copy Markdown
Owner Author

Merged after testing.

@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.3.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep Aiohttp Session Open Between API Queries

1 participant