Skip to content

Commit

Permalink
fix: worker timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaquiery committed Jan 21, 2025
1 parent 573732c commit 616b813
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
concurrency: demo-group
env:
DEMO_BACKEND_VERSION: "v2.5.2-dev"
DEMO_BACKEND_VERSION: "v2.5.3-dev"
FRONTEND_URL: "https://galv-demo.fly.dev"
FLY_DEMO_NAME: "galv-demo-backend"
FLY_DEMO_DB_NAME: "galv-demo-db"
Expand Down
2 changes: 1 addition & 1 deletion backend_django/config/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Build paths inside the project like this: BASE_DIR / 'subdir'.
import os

API_VERSION = "2.5.2-dev"
API_VERSION = "2.5.3-dev"

try:
USER_ACTIVATION_TOKEN_EXPIRY_S = int(
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project = "Galv"
copyright = "2023, Oxford RSE"
author = "Oxford RSE"
release = "2.5.2-dev"
release = "2.5.3-dev"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/tags.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["v2.2.0", "v2.3.1", "v2.5.2-dev", "main"]
["v2.2.0", "v2.3.1", "v2.5.3-dev", "main"]
1 change: 1 addition & 0 deletions fly.demo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ console_command = "/code/backend_django/manage.py shell"
DJANGO_DEFAULT_FROM_EMAIL = '[email protected]'
DJANGO_LAB_STORAGE_QUOTA_BYTES = "10_000_000_000" # 10GB
DJANGO_LOG_LEVEL = "DEBUG"
WORKERS_PER_CORE = "1"

[http_service]
internal_port = 80
Expand Down
8 changes: 5 additions & 3 deletions server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

set -e

WORKERS_PER_CORE = ${WORKERS_PER_CORE:-2}
WORKERS = ${WORKERS:-$(nproc * WORKERS_PER_CORE)}
TIMEOUT = ${TIMEOUT:-60}

# Wrap the user's command to run prematter first
# The prematter relies on envvars, so can't be run at build time

if [ -z "$1" ]; then
# No custom command provided, so run the default
# Determine the number of workers from number of cores * 4
WORKERS=$(nproc)
WORKERS=$((WORKERS * 1))
COMMAND="gunicorn --bind localhost:8000 --workers $WORKERS config.wsgi"
COMMAND="gunicorn --bind localhost:8000 --workers $WORKERS --timeout $TIMEOUT config.wsgi"
MESSAGE="Starting server: $COMMAND"
else
COMMAND="$@"
Expand Down

0 comments on commit 616b813

Please sign in to comment.