slack-ruby / slack-ruby-client

A Ruby and command-line client for the Slack Web, Real Time Messaging and Event APIs.
MIT License
1.21k stars 214 forks source link

client.on :message stops listening to new messages #484

Open MarioRuiz opened 1 year ago

MarioRuiz commented 1 year ago

randomly client.on :message stops listening to RTM No logs even stored after that on the supplied logger but the app shows as connected. No clue what exactly happens, same code has been working for years without issues. any idea how can we identify the reason?

dblock commented 1 year ago

I would start from isolating whether this is a problem where Slack stops sending messages, whether the websocket gets closed, a blocking thread in the app, or something else. Enable debug logging and look for https://github.com/slack-ruby/slack-ruby-client/blob/bf5bb4be3e03e9bd74d22942a61d5611f5c1d997/lib/slack/real_time/client.rb#L83 or any other messages being hit.

Next, it's probably time to move to events, https://github.com/dblock/slack-ruby-bot-server-events. Slack is likely slowly making it more and more difficult to run realtime clients.

dblock commented 1 year ago

@MarioRuiz Did you ever find the root cause of this? Could be code that hangs (and potentially solved with https://github.com/slack-ruby/slack-ruby-client/pull/486)?