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][websocket] Fix webSocketPingDurationSeconds config #19256

Merged
merged 2 commits into from
Jan 20, 2023

Conversation

nodece
Copy link
Member

@nodece nodece commented Jan 17, 2023

Motivation

#19203 introduces webSocketPingDurationSeconds config, but doesn't add this config to the proxy and broker config class.

When the proxy/broker calls the WebSocketService(ClusterData localCluster, ServiceConfiguration config), the ping feature will be broken.

Modifications

  • Add webSocketPingDurationSeconds to ProxyConfiguration
  • Add webSocketPingDurationSeconds to ServiceConfiguration
  • Improve reading the webSocketPingDurationSeconds

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

Sorry, something went wrong.

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 17, 2023
@nodece nodece requested a review from Technoboy- January 17, 2023 10:33
@codelipenghui codelipenghui added this to the 2.12.0 milestone Jan 18, 2023
@nodece
Copy link
Member Author

nodece commented Jan 18, 2023

/pulsarbot rerun-failure-checks

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2023

Codecov Report

Attention: Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 52.81%. Comparing base (334c3a5) to head (f3d8640).
Report is 1820 commits behind head on master.

Files with missing lines Patch % Lines
...che/pulsar/websocket/AbstractWebSocketHandler.java 25.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #19256      +/-   ##
============================================
+ Coverage     47.04%   52.81%   +5.77%     
- Complexity     9190    22326   +13136     
============================================
  Files           607     1824    +1217     
  Lines         57677   136681   +79004     
  Branches       6007    15037    +9030     
============================================
+ Hits          27132    72194   +45062     
- Misses        27598    56975   +29377     
- Partials       2947     7512    +4565     
Flag Coverage Δ
inttests 22.43% <33.33%> (?)
systests 24.93% <25.00%> (?)
unittests 47.07% <41.66%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...org/apache/pulsar/broker/ServiceConfiguration.java 98.38% <100.00%> (ø)
...apache/pulsar/proxy/server/ProxyConfiguration.java 97.90% <100.00%> (ø)
.../org/apache/pulsar/websocket/WebSocketService.java 65.73% <ø> (ø)
...che/pulsar/websocket/AbstractWebSocketHandler.java 39.85% <25.00%> (ø)

... and 1352 files with indirect coverage changes

@nodece nodece requested a review from coderzc January 18, 2023 09:10
@nodece
Copy link
Member Author

nodece commented Jan 18, 2023

Ping @poorbarcode

category = CATEGORY_WEBSOCKET,
doc = "Interval of time to sending the ping to keep alive in WebSocket proxy. "
+ "This value greater than 0 means enabled")
private int webSocketPingDurationSeconds = -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use webSocketKeepAliveIntervalSeconds to make it consistent with the existing name keepAliveIntervalSeconds

And we should also add keepAliveIntervalSeconds to websocket.conf

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already add this to other branches, so I don't suggest rename to keepAliveIntervalSeconds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@nodece nodece requested a review from codelipenghui January 19, 2023 03:57
Copy link
Contributor

@poorbarcode poorbarcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also should edit the test added in #19203?

@@ -192,18 +191,15 @@ private void closePingFuture() {
@Override
public void onWebSocketConnect(Session session) {
super.onWebSocketConnect(session);
WebSocketProxyConfiguration webSocketProxyConfig = service.getWebSocketProxyConfig();
if (webSocketProxyConfig != null) {
int webSocketPingDurationSeconds = webSocketProxyConfig.getWebSocketPingDurationSeconds();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the field webSocketPingDurationSeconds in class WebSocketProxyConfiguration not useful now? If yes, should we delete it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these configurations can be converted to each other, so add webSocketPingDurationSeconds to each config.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

Should we also should edit the test added in #19203?

And this comment ^_^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. My changes don't break the tests of #19203.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. My changes don't break the tests of #19203.

Ah, yes. you are right. The configuration that acts on WebSocketProxyConfiguration is copied to ServiceConfiguration.

@nodece
Copy link
Member Author

nodece commented Jan 19, 2023

branch-2.10 and branch-2.11 include these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants