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

Respond to Slack immediately #2

Open
ghost opened this issue Mar 16, 2021 · 1 comment
Open

Respond to Slack immediately #2

ghost opened this issue Mar 16, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Mar 16, 2021

Looking for help on an issue I'm having while using this gem. Is there a natural way to respond to Slack immediately upon receiving an event with a 200 status? I've been having the issue that if any of the code in my commands takes too long to complete, Slack resends the event, causing our bot to occasionally post to a channel 2-3 times. It seems like currently a success status isn't returned to Slack until the self.call method reaches its end. This has also been a pain when debugging, as throwing a binding.pry in a command to troubleshoot something has the pry reopen every time Slack resends the event.

@dblock
Copy link
Contributor

dblock commented Mar 16, 2021

There's no built-in way today in Grape to return a 200 status, and keep processing the request afterwards. This is something that I would like to have implemented, potentially built into slack-ruby-bot-server-events.

I would try to defer execution within the callback, which could be done with async, as discussed in slack-ruby/slack-ruby-client#237 and socketry/async-websocket#2. If you can make it work, maybe we can discuss how to make it available as an extension for others to reuse?

This is also related to slack-ruby/slack-ruby-bot#49, where the issue was blocking other messages.

@dblock dblock added the enhancement New feature or request label Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant