node-slack-interactive-messages icon indicating copy to clipboard operation
node-slack-interactive-messages copied to clipboard

queue all calls to `respond()` by default

Open aoberoi opened this issue 8 years ago • 1 comments

Description

Currently, if you call respond() twice successively, there is no ordering guarantee on how the messages in Slack will update. If this is within an interactive message (button or menu), one call will overwrite the other but its a race condition. If its within a dialog submission (or a button or menu using the replace_original: false argument) then two messages will be created but in an arbitrary order.

The only way to rely on the ordering would be to wait on the first call's HTTP response to complete before sending the second call. This can be done by the developer once the return value of respond() is specified (#37), but its still not intuitive.

We can implement a queue with a max concurrency of 1 in the adapter such that calls to respond() are serially sent to Slack. This would result in more intuitive behavior. One recommendation for implementing this queue is the p-queue package (it's also used in @slack/client).

It may also be useful to add an optional parameter that skips the queue and sends the request as soon as possible.

Requirements

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

aoberoi avatar Apr 17 '18 21:04 aoberoi

https://github.com/slackapi/node-slack-sdk/issues/824

shaydewael avatar Jul 16 '19 20:07 shaydewael