slackapi / java-slack-sdk

Slack Developer Kit (including Bolt for Java) for any JVM language
https://slack.dev/java-slack-sdk/
MIT License
570 stars 209 forks source link

Fix #1256 Socket Mode connection error issue #1265

Closed seratch closed 7 months ago

seratch commented 7 months ago

This pull request resolves #1256 (and probably #1223 too) by improving the internals of the Socket Mode client code, thanks to @oppokui. This pull request changes the default behavior of the onClose listener not to try to reconnect. Originally, the logic was introduced to let the client get back to online much faster, and it has been working well as long as the server side behaves as the code expects. However, it seems that the server now works differently for some reason. Thus, revisiting the logic should be reasonable. Also, the change should be safe enough for the reasons mentioned in the code comment.

If some users would like to switch back to the previous logic for a certain logic, calling SocketModeClient#setAutoReconnectOnCloseEnabled(true) enables them to do so.

Category (place an x in each of the [ ])

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (5afc51b) 74.32% compared to head (97f9617) 74.36%.

Files Patch % Lines
...va/com/slack/api/socket_mode/SocketModeClient.java 0.00% 5 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1265 +/- ## ============================================ + Coverage 74.32% 74.36% +0.04% - Complexity 4121 4126 +5 ============================================ Files 443 443 Lines 13078 13087 +9 Branches 1322 1323 +1 ============================================ + Hits 9720 9732 +12 + Misses 2586 2582 -4 - Partials 772 773 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.