Skip to content

Commit

Permalink
Merge pull request #1047 from RasaHQ/ENG-680-DEFAULT_KEEP_ALIVE_TIMEOUT
Browse files Browse the repository at this point in the history
Fix connection to action server - [ENG 680]
  • Loading branch information
tmbo authored Nov 22, 2023
2 parents ee729a7 + 98ac3c2 commit 541a7c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions rasa_sdk/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DEFAULT_SERVER_PORT = 5055
DEFAULT_SANIC_WORKERS = 1
DEFAULT_KEEP_ALIVE_TIMEOUT = 120 # in seconds
ENV_SANIC_WORKERS = "ACTION_SERVER_SANIC_WORKERS"
DEFAULT_LOG_LEVEL_LIBRARIES = "ERROR"
ENV_LOG_LEVEL_LIBRARIES = "LOG_LEVEL_LIBRARIES"
Expand Down
4 changes: 3 additions & 1 deletion rasa_sdk/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from rasa_sdk import utils
from rasa_sdk.cli.arguments import add_endpoint_arguments
from rasa_sdk.constants import DEFAULT_SERVER_PORT
from rasa_sdk.constants import DEFAULT_KEEP_ALIVE_TIMEOUT, DEFAULT_SERVER_PORT
from rasa_sdk.executor import ActionExecutor
from rasa_sdk.interfaces import ActionExecutionRejection, ActionNotFoundException
from rasa_sdk.plugin import plugin_manager
Expand Down Expand Up @@ -160,6 +160,7 @@ def run(
ssl_password: Optional[Text] = None,
auto_reload: bool = False,
tracer_provider: Optional[TracerProvider] = None,
keep_alive_timeout: int = DEFAULT_KEEP_ALIVE_TIMEOUT,
) -> None:
"""Starts the action endpoint server with given config values."""
logger.info("Starting action endpoint server...")
Expand All @@ -169,6 +170,7 @@ def run(
auto_reload=auto_reload,
tracer_provider=tracer_provider,
)
app.config.KEEP_ALIVE_TIMEOUT = keep_alive_timeout
## Attach additional sanic extensions: listeners, middleware and routing
logger.info("Starting plugins...")
plugin_manager().hook.attach_sanic_app_extensions(app=app)
Expand Down

0 comments on commit 541a7c9

Please sign in to comment.