@@ -189,9 +189,11 @@ def run_frontend_prod(root: Path, port: str, backend_present: bool = True):
189189
190190@once
191191def _warn_user_about_uvicorn ():
192- console .warn (
193- "Using Uvicorn for backend as it is installed. This behavior will change in 0.8.0 to use Granian by default."
194- )
192+ # When we eventually switch to Granian by default, we should enable this warning.
193+ if False :
194+ console .warn (
195+ "Using Uvicorn for backend as it is installed. This behavior will change in 0.8.0 to use Granian by default."
196+ )
195197
196198
197199def should_use_granian ():
@@ -357,70 +359,74 @@ def run_granian_backend(host: str, port: int, loglevel: LogLevel):
357359 ).serve ()
358360
359361
362+ def _deprecate_asgi_config (
363+ config_name : str ,
364+ reason : str = "" ,
365+ ):
366+ # When we eventually switch to Granian by default, we should enable this deprecation.
367+ if False :
368+ console .deprecate (
369+ f"config.{ config_name } " ,
370+ reason = reason ,
371+ deprecation_version = "0.7.5" ,
372+ removal_version = "0.8.0" ,
373+ )
374+
375+
360376@once
361377def _get_backend_workers ():
362378 from reflex .utils import processes
363379
364380 config = get_config ()
365381
382+ gunicorn_workers = config .gunicorn_workers or 0
383+
366384 if config .gunicorn_workers is not None :
367- console .deprecate (
368- "config.gunicorn_workers" ,
369- reason = "If you're using Granian, use GRANIAN_WORKERS instead." ,
370- deprecation_version = "0.7.4" ,
371- removal_version = "0.8.0" ,
385+ _deprecate_asgi_config (
386+ "gunicorn_workers" ,
387+ "If you're using Granian, use GRANIAN_WORKERS instead." ,
372388 )
373389
374- return (
375- processes .get_num_workers ()
376- if not config .gunicorn_workers
377- else config .gunicorn_workers
378- )
390+ return gunicorn_workers if gunicorn_workers else processes .get_num_workers ()
379391
380392
381393@once
382394def _get_backend_timeout ():
383395 config = get_config ()
384396
397+ timeout = config .timeout or 120
398+
385399 if config .timeout is not None :
386- console .deprecate (
387- "config.timeout" ,
388- reason = "If you're using Granian, use GRANIAN_WORKERS_LIFETIME instead." ,
389- deprecation_version = "0.7.4" ,
390- removal_version = "0.8.0" ,
400+ _deprecate_asgi_config (
401+ "timeout" ,
402+ "If you're using Granian, use GRANIAN_WORKERS_LIFETIME instead." ,
391403 )
392404
393- return config . timeout
405+ return timeout
394406
395407
396408@once
397409def _get_backend_max_requests ():
398410 config = get_config ()
399411
412+ gunicorn_max_requests = config .gunicorn_max_requests or 120
413+
400414 if config .gunicorn_max_requests is not None :
401- console .deprecate (
402- "config.gunicorn_max_requests" ,
403- reason = "" ,
404- deprecation_version = "0.7.4" ,
405- removal_version = "0.8.0" ,
406- )
415+ _deprecate_asgi_config ("gunicorn_max_requests" )
407416
408- return config . gunicorn_max_requests
417+ return gunicorn_max_requests
409418
410419
411420@once
412421def _get_backend_max_requests_jitter ():
413422 config = get_config ()
414423
424+ gunicorn_max_requests_jitter = config .gunicorn_max_requests_jitter or 25
425+
415426 if config .gunicorn_max_requests_jitter is not None :
416- console .deprecate (
417- "config.gunicorn_max_requests_jitter" ,
418- reason = "" ,
419- deprecation_version = "0.7.4" ,
420- removal_version = "0.8.0" ,
421- )
427+ _deprecate_asgi_config ("gunicorn_max_requests_jitter" )
422428
423- return config . gunicorn_max_requests_jitter
429+ return gunicorn_max_requests_jitter
424430
425431
426432def run_backend_prod (
0 commit comments