Skip to content

Commit

Permalink
Configure gunicorn's timeout to 120s by default
Browse files Browse the repository at this point in the history
This will help prevent critical worker timeout issues.
  • Loading branch information
nickjj committed Jun 30, 2024
1 parent 481838c commit 2046b3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export WEB_CONCURRENCY=1
#export WEB_RELOAD=false
export WEB_RELOAD=true

# Configure the timeout value in seconds for gunicorn.
#export WEB_TIMEOUT=120

# You'll always want to set POSTGRES_USER and POSTGRES_PASSWORD since the
# postgres Docker image uses them for its default database user and password.
export POSTGRES_USER=hello
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Added

- `WEB_TIMEOUT` environment variable to configure gunicorn's timeout value (defaults to 120s)

### Changed

- Convert `SECRET_KEY` into a required env var
Expand Down
2 changes: 2 additions & 0 deletions config/gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
threads = int(os.getenv("PYTHON_MAX_THREADS", 1))

reload = bool(strtobool(os.getenv("WEB_RELOAD", "false")))

timeout = int(os.getenv("WEB_TIMEOUT", 120))

0 comments on commit 2046b3f

Please sign in to comment.