Skip to content

Commit

Permalink
Add timeout option for backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
trisyoungs committed Mar 4, 2024
1 parent b3c4cf0 commit 0a45ef6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions backend/src/jv2backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ def load(self):
options = {
'bind': args.bind,
}
if args.timeout:
options["timeout"] = args.timeout
if args.debug:
options["log-level"] = "INFO"
GUnicornApplication(jv2app, options).run()

def go_waitress(jv2app: Flask, args):
from waitress import serve

serve(jv2app, listen=args.bind)
serve(jv2app, listen=args.bind, channel_timeout=args.timeout)



Expand All @@ -92,14 +94,18 @@ def go():
type=str, required=True,
help="Address to bind to (e.g. 127.0.0.1:5000)"
)
parser.add_argument('-w', '--waitress',
action='store_true',
help="Whether to use waitress over gunicorn."
)
parser.add_argument('-d', '--debug',
action='store_true',
help="Enable debug logging from the WSGI server."
)
parser.add_argument('-t', '--timeout',
type=int, default=120,
help="Set request timeout (in second) for the server."
)
parser.add_argument('-w', '--waitress',
action='store_true',
help="Whether to use waitress over gunicorn."
)

args = parser.parse_args()

Expand Down
1 change: 1 addition & 0 deletions frontend/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Backend::Backend(const QCommandLineParser &args) : process_()

process_.setProgram("jv2backend");
backendArgs << "-b" << bindAddress();
backendArgs << "-t" << "300";
if (args.isSet(CLIArgs::DebugBackend))
backendArgs << "-d";
if (args.isSet(CLIArgs::UseWaitress))
Expand Down

0 comments on commit 0a45ef6

Please sign in to comment.