-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 websocket ping variables issues #1909
Conversation
…arameter settings did not take effect
@brooklet Can you take a look at the failing tests? |
sanic/server.py
Outdated
@@ -955,14 +955,14 @@ def serve( | |||
def _build_protocol_kwargs( | |||
protocol: Type[HttpProtocol], config: Config | |||
) -> dict: | |||
if hasattr(protocol, "websocket_timeout"): | |||
if (dir(protocol).__contains__("websocket_handshake")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking for properties this way? Please avoid using dir()
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted to hasattr
, but I might circle back on this to see why we are not using isinstance
here, which seems more logical. Do we need duck typing for some reason I am unaware of?
"ping_timeout": config.WEBSOCKET_PING_TIMEOUT, | ||
"ping_interval": config.WEBSOCKET_PING_INTERVAL, | ||
"websocket_max_size": config.WEBSOCKET_MAX_SIZE, | ||
"websocket_max_queue": config.WEBSOCKET_MAX_QUEUE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these being renamed websocket_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left this change in, but I updated the tests so that the change was carried through consistently.
@brooklet we want to try to get this merged before the Sanic 2020-09 release. Are you able to make those changes suggested? |
fixed the problem that the websocket ping_timeout and ping_interval parameter settings did not take effect