Skip to content

Commit

Permalink
fix: Added & parameterized max-worker-lifetime-delta, disabled uWSGI …
Browse files Browse the repository at this point in the history
…strict mode (#366)

* add max-worker-lifetime-delta to uwsgi.ini

* Parameterize max-worker-lifetime-delta

* update README with UWSGI_WORKER_LIFETIME_DELTA

* remove --strict flag from uwsgi cmd until bug is resolved

* change UWSGI_WORKER_LIFETIME_DELTA default to 3 seconds

* grammatical improvement

---------

Co-authored-by: Nick Satterly <[email protected]>
  • Loading branch information
creganFL and satterly authored Jun 22, 2023
1 parent ffa44a6 commit d77577f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ENV UWSGI_PROCESSES=5
ENV UWSGI_LISTEN=100
ENV UWSGI_BUFFER_SIZE=8192
ENV UWSGI_MAX_WORKER_LIFETIME=30
ENV UWSGI_WORKER_LIFETIME_DELTA=3

ENV HEARTBEAT_SEVERITY=major
ENV HK_EXPIRED_DELETE_HRS=2
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ API to ease deployment more generally:
`UWSGI_MAX_WORKER_LIFETIME`
- reload worker after this many seconds (default:`30`)

`UWSGI_WORKER_LIFETIME_DELTA`
- time in seconds to stagger UWSGI worker respawns (default:`3`)

Configuration Files
-------------------

Expand Down
2 changes: 1 addition & 1 deletion config/templates/app/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ loglevel={{ env.SUPERVISORD_LOG_LEVEL|lower or 'debug' }}
pidfile=/tmp/supervisord.pid

[program:uwsgi]
command=/venv/bin/uwsgi --ini /app/uwsgi.ini --strict
command=/venv/bin/uwsgi --ini /app/uwsgi.ini
redirect_stderr=true

[program:nginx]
Expand Down
1 change: 1 addition & 0 deletions config/templates/app/uwsgi.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ processes = {{ env.UWSGI_PROCESSES }}
listen = {{ env.UWSGI_LISTEN }}
{%- if env.UWSGI_MAX_WORKER_LIFETIME %}
max-worker-lifetime = {{ env.UWSGI_MAX_WORKER_LIFETIME }}
max-worker-lifetime-delta = {{ env.UWSGI_WORKER_LIFETIME_DELTA }}
{%- endif %}

{%- if env.UWSGI_THREADS %}
Expand Down

0 comments on commit d77577f

Please sign in to comment.