slack-morphism-rust: Using blocking push events functions

Is there a way that I can pass a blocking function (i.e. not async) somehow to SlackSocketModeListenerCallbacks in with_push_events()? Currently the asyncness forces me to turn almost all my code into async and that is not my intention. It causes weird behaviours of the bot replying several times to the same request etc.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

Thank you very much for all the help! I really appreciate it.

wow you’re awesome - that solved it! So now with this architecture I end up opening up a new session each time a message is sent. Is that normal? I assume the session gets closed at the end of the scope right? I also left the two kinds of event subscriptions - it does not bother me that a mention message gets matched twice as long as I see one reply, which I do now. Last question: If I’ll make eval_code (and as a consequence execute() and create_share_link()) to be async, will I gain speed? And if so, then I still need to use tokio::spawn::(async move ...) or is it tokio::task::spawn_blocking() now? This is the first project in Rust that I do with async so that’s why I’m not sure about a lot of things