Skip to content

fix(gunicorn): respect GUNICORN_KEEP_ALIVE and GUNICORN_CMD_ARGS - #275

Merged
khvn26 merged 3 commits into
mainfrom
fix/gunicorn-keep-alive-and-cmd-args
Oct 1, 2026
Merged

khvn26 merged 3 commits into
mainfrom
fix/gunicorn-keep-alive-and-cmd-args

Conversation

@khvn26

@khvn26 khvn26 commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Contributes to Flagsmith/flagsmith#8543.

  • Read GUNICORN_KEEP_ALIVE (default 2).
  • Apply GUNICORN_CMD_ARGS, previously ignored. Precedence: defaults < GUNICORN_CMD_ARGS < CLI options.

We also bump the gunicorn dependency constraint to an up-to-date value.

@khvn26
khvn26 requested a review from a team as a code owner October 1, 2026 16:06
@khvn26
khvn26 requested review from emyller and removed request for a team October 1, 2026 16:06
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 50a795b7-3d07-4be0-aa76-6180afe133c7

📥 Commits

Reviewing files that changed from the base of the PR and between 11cfa28 and d3edbfe.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • pyproject.toml
  • src/common/gunicorn/utils.py
  • tests/unit/common/gunicorn/test_utils.py
📝 Walkthrough

Walkthrough

serve and migrate_and_serve now pass supplied arguments before api. Gunicorn configuration now reads GUNICORN_CMD_ARGS, applies environment options between defaults and explicit options, and sets a configurable keepalive default. Unit tests cover argument forwarding, option values and precedence.

Estimated code review effort: 3 (Moderate) | ~20 minutes

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@codecov-commenter

codecov-commenter commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.66%. Comparing base (0196ebd) to head (d3edbfe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
+ Coverage   97.64%   97.66%   +0.01%     
==========================================
  Files         110      110              
  Lines        4919     4958      +39     
==========================================
+ Hits         4803     4842      +39     
  Misses        116      116              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 940a033c-d558-47de-b464-11963edaa294

📥 Commits

Reviewing files that changed from the base of the PR and between 0196ebd and 11cfa28.

📒 Files selected for processing (4)
  • src/common/core/cli/run.py
  • src/common/gunicorn/utils.py
  • tests/unit/common/core/test_run.py
  • tests/unit/common/gunicorn/test_utils.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread src/common/gunicorn/utils.py
@khvn26
khvn26 force-pushed the fix/gunicorn-keep-alive-and-cmd-args branch from 11cfa28 to 06c8e7e Compare October 1, 2026 16:15
@khvn26 khvn26 changed the title fix(gunicorn): respect GUNICORN_KEEP_ALIVE, GUNICORN_CMD_ARGS and serve gunicorn args fix(gunicorn): respect GUNICORN_KEEP_ALIVE and GUNICORN_CMD_ARGS Oct 1, 2026
khvn26 added 2 commits October 1, 2026 18:16
`DjangoWSGIApplication.load_config` relies on `Config.get_cmd_args_from_env`,
added in gunicorn 19.7. Raise the floor to the version we lock and test
against, rather than another untested minimum.
@khvn26
khvn26 merged commit 23751e9 into main Oct 1, 2026
5 checks passed
@khvn26
khvn26 deleted the fix/gunicorn-keep-alive-and-cmd-args branch October 1, 2026 17:45
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.

3 participants