Tweaks to get API to stop hanging?

This commit is contained in:
Scott Idem
2024-04-24 11:56:48 -04:00
parent 648224add7
commit fc04c04044
3 changed files with 15 additions and 10 deletions

View File

@@ -87,12 +87,12 @@ AETHER_CFG['app']['path_hosted_tmp_root']: str = None
AETHER_CFG['api'] = {}
AETHER_CFG['api']['protocol'] = os.getenv('AE_API_PROTOCOL', 'https') # 'https' # https
AETHER_CFG['api']['server'] = os.getenv('AE_API_SERVER', None) # 'dev-api.oneskyit.com' # linode.oneskyit.com vpn-linode linode.oneskyit.local
AETHER_CFG['api']['port'] = os.getenv('AE_API_PORT', '443') # '443' # default = 3306
AETHER_CFG['api']['port'] = os.getenv('AE_API_PORT', '443')
AETHER_CFG['api']['path'] = os.getenv('AE_API_PATH', '') # ''
AETHER_CFG['api']['secret_key'] = os.getenv('AE_API_SECRET_KEY', None)
AETHER_CFG['api']['protocol_backup'] = 'http' # https
AETHER_CFG['api']['server_backup'] = 'dev-fastapi.oneskyit.local' # linode.oneskyit.com vpn-linode linode.oneskyit.local
AETHER_CFG['api']['port_backup'] = '5005' # default = 3306
AETHER_CFG['api']['protocol_backup'] = 'https' # https
AETHER_CFG['api']['server_backup'] = 'bak-api.oneskyit.com' # linode.oneskyit.com vpn-linode linode.oneskyit.local
AETHER_CFG['api']['port_backup'] = '443'
AETHER_CFG['api']['path_backup'] = ''
AETHER_CFG['api']['secret_key_backup'] = 'the secret backup key'
AETHER_CFG['api']['temporary_token'] = {}

View File

@@ -22,18 +22,21 @@ wsgi_app = "app.main:app"
# default_proc_name = "app.main:app"
# Setting a long timeout since some FastAPI API requests may take a while
timeout = os.getenv('AE_API_GUNICORN_TIMEOUT', 2100) # default 30; 1200 is NOT enough; worker process silent then kill and restart
graceful_timeout = os.getenv('AE_API_GUNICORN_GRACEFUL_TIMEOUT', 20) # default 30; timeout after restart signal; tried 10 2023-07-11
keepalive = os.getenv('AE_API_GUNICORN_KEEPALIVE', 30) # default 2; setting higher because behind load balancer (nginx); tried 10 2023-07-11
timeout = os.getenv('AE_API_GUNICORN_TIMEOUT', 30) # default 30; 1200 is NOT enough; worker process silent then kill and restart
graceful_timeout = os.getenv('AE_API_GUNICORN_GRACEFUL_TIMEOUT', 30) # default 30; timeout after restart signal; tried 10 2023-07-11
keepalive = os.getenv('AE_API_GUNICORN_KEEPALIVE', 4) # default 2; not used with sync workers; setting higher because behind load balancer (nginx); tried 10 2023-07-11
# Reload does not work correctly with UvicornWorker
# https://github.com/benoitc/gunicorn/issues/2339
# Disable reload if using more than one thread
##### reload = True
reload = False
# reload_engine = "poll"
worker_class = "uvicorn.workers.UvicornWorker" # default "sync"
# worker_class = "gthread"
# worker_class = "aiohttp.worker.GunicornWebWorker"
# worker_class = "gevent" # for gthread?
# Works are processes, not threads
# workers = 9 # default 1; use 10ish for production; 2 to 4 times the number of cores
# threads = 1 # default 1; only affects Gthread worker type

View File

@@ -5,6 +5,7 @@
# aioredis # BAD! Not maintained!
aiofiles
# aiohttp # added 2024-04-24
# anyio
argon2-cffi
argon2-cffi-bindings
@@ -20,8 +21,9 @@ dnspython
email-validator
et-xmlfile
fastapi>=0.88.0
greenlet>=2.0.2
gunicorn>=21.2.0
# greenlet>=2.0.2
# gevent
gunicorn>=22.0.0
h11
html2text>=2020.1.16
httpcore