Conversation
There was a problem hiding this comment.
Code Review
This pull request significantly enhances Docker Swarm integration and container lifecycle management. Key additions include a new prefer-local swarm mode that prioritizes local task containers over service VIPs, support for Docker healthchecks to gate backend registration, and a configurable BACKEND_START_GRACE_SECONDS to prevent premature reloads for starting containers. Additionally, the StickySessionProcessor has been replaced by a more comprehensive UpstreamProcessor. Feedback identifies a high-severity issue in WebServer.py where an optimization that skips updates for existing container backends prevents the proxy from detecting dynamic changes, such as a container connecting to a new network after its initial start.
| existing_backend = self.config_data.has_backend(backend.id) | ||
| if existing_backend and backend.type != "service": | ||
| return False |
There was a problem hiding this comment.
The optimization that skips updates for existing container backends prevents the proxy from picking up dynamic changes, such as a container connecting to a new network after it has already started. Since DockerEventListener calls update_backend specifically when such events occur, this check causes those updates to be ignored for containers. It is recommended to allow updates for all backend types to ensure the configuration remains in sync with the Docker state, especially since the Throttler and Nginx configuration comparison already handle performance concerns efficiently.
| existing_backend = self.config_data.has_backend(backend.id) | |
| if existing_backend and backend.type != "service": | |
| return False | |
| existing_backend = self.config_data.has_backend(backend.id) |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #51 +/- ##
==========================================
+ Coverage 61.32% 66.06% +4.73%
==========================================
Files 30 30
Lines 2384 2879 +495
Branches 382 463 +81
==========================================
+ Hits 1462 1902 +440
- Misses 829 848 +19
- Partials 93 129 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ) | ||
|
|
||
| assert "bad_source.example.com" not in vhost_map | ||
| assert "valid-source.example.com" in vhost_map |
|
/gemini help |
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces significant enhancements to Docker Swarm support, most notably a new prefer-local discovery mode that prioritizes healthy local task containers and utilizes the service VIP as a fallback. The internal architecture is refactored to use a thread-safe command queue and dispatcher for Docker events, which now includes support for container healthchecks and a configurable startup grace period to improve reliability. Additionally, the PR adds a dedicated reload mechanism via SIGHUP, improves hostname validation, and includes extensive integration tests for these new features. Feedback was provided regarding the dispatcher's error handling to ensure that termination signals lead to a graceful shutdown rather than just killing the daemon thread.
| except (KeyboardInterrupt, SystemExit): | ||
| raise |
There was a problem hiding this comment.
Raising KeyboardInterrupt or SystemExit inside a daemon thread will not terminate the main process; it will only kill the dispatcher thread. This could leave the application in a broken state where events are enqueued but never processed. It is better to log the termination and rely on the _STOP sentinel for graceful shutdown.
No description provided.