Skip to content

Commit

Permalink
Update server-related code for Granian 1.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed May 29, 2024
1 parent fccfc9c commit 0b2bc64
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions emmett/_reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def run_with_reloader(
port,
loop='auto',
log_level=None,
log_access=False,
threads=1,
threading_mode="workers",
ssl_certfile: Optional[str] = None,
Expand All @@ -177,6 +178,7 @@ def run_with_reloader(
kwargs={
"loop": loop,
"log_level": log_level,
"log_access": log_access,
"threads": threads,
"threading_mode": threading_mode,
"ssl_certfile": ssl_certfile,
Expand Down
11 changes: 10 additions & 1 deletion emmett/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def develop_command(
port,
loop=loop,
log_level='debug',
log_access=True,
threads=1,
threading_mode="workers",
ssl_certfile=ssl_certfile,
Expand Down Expand Up @@ -326,17 +327,23 @@ def develop_command(
@click.option(
'--log-level', type=click.Choice(LOG_LEVELS.keys()), default='info',
help='Logging level.')
@click.option(
'--access-log/--no-access-log', is_flag=True, default=False,
help='Enable access log.')
@click.option(
'--backlog', type=int, default=2048,
help='Maximum number of connections to hold in backlog')
@click.option(
'--backpressure', type=int,
help='Maximum number of requests to process concurrently (per worker)')
@click.option(
'--ssl-certfile', type=str, default=None, help='SSL certificate file')
@click.option(
'--ssl-keyfile', type=str, default=None, help='SSL key file')
@pass_script_info
def serve_command(
info, host, port, workers, threads, threading_mode, interface, ws, loop, opt,
log_level, backlog, ssl_certfile, ssl_keyfile
log_level, access_log, backlog, backpressure, ssl_certfile, ssl_keyfile
):
app_target = info._get_import_name()
sgi_run(
Expand All @@ -347,10 +354,12 @@ def serve_command(
loop=loop,
loop_opt=opt,
log_level=log_level,
log_access=access_log,
workers=workers,
threads=threads,
threading_mode=threading_mode,
backlog=backlog,
backpressure=backpressure,
enable_websockets=ws,
ssl_certfile=ssl_certfile,
ssl_keyfile=ssl_keyfile,
Expand Down
5 changes: 4 additions & 1 deletion emmett/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ def run(
loop='auto',
loop_opt=False,
log_level=None,
log_access=False,
workers=1,
threads=1,
threading_mode='workers',
backlog=1024,
backpressure=None,
enable_websockets=True,
ssl_certfile: Optional[str] = None,
ssl_keyfile: Optional[str] = None
Expand All @@ -38,13 +40,14 @@ def run(
interface=interface,
workers=workers,
threads=threads,
pthreads=threads,
threading_mode=threading_mode,
loop=loop,
loop_opt=loop_opt,
websockets=enable_websockets,
backlog=backlog,
backpressure=backpressure,
log_level=log_level,
log_access=log_access,
ssl_cert=ssl_certfile,
ssl_key=ssl_keyfile
)
Expand Down

0 comments on commit 0b2bc64

Please sign in to comment.