Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connection to action server - [ENG 680] #1047

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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