Skip to content

Is it normal that non-blocking operations, in fact, are blocking the code execution in async mode? #619

@djachkov

Description

@djachkov

Description

Hello!
I have a question about the usage of the RTM API in async mode.
I've been explaining my colleague about the async functions and non-blocking operations on the example of the slack-bot. And when I've put the asyncio.sleep(10) in the app and was ready to demonstrate how I still can execute another command - it turned out, that asyncio.sleep(10) has completely blocked all code execution for the 10 seconds and slack bot can't handle any other event while running coroutine was sleeping.
I'm not quite sure how it should works in this library and it possible, that I'm doing something wrong.
As I understand - async mode should help me to run commands separately each other, without waiting while another command makes all their work. Am I wrong? Is there any way to do that?
To reproduce this behavior you can just run the example onboarding_tutorial async bot and add await asyncio.sleep() in any function.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

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

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

Reproducible in:

slackclient version: 2.5.0

python version: 3.7.4, 3.8.0

OS version(s): MacOS 10.15

Steps to reproduce:

  1. Take https://github.com/slackapi/python-slackclient/blob/master/tutorial/PythOnBoardingBot/async_app.py
  2. Add some async non-blocking (but long-time executing) operation, like asyncio.sleep()
  3. Be completely helpless in trying to run another command

Expected result:

Events handle asynchronously

Actual result:

Events execute one after one

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions