-
Notifications
You must be signed in to change notification settings - Fork 103
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
Unable to run concurrent asyncio processes #396
Comments
This needs further looking into but we have two execution paths. Regular (
However this is rather unintuitive as it blocks new requests. This needs further reflection as I'm not sure threading the work is safe. @jneeven 's advice would be welcome here as this looks like a deliberate design choice. |
I share the concern that the current implementation is potentially unsafe. Both One might suggest that, when there is a race condition risk, plugin developers should avoid using The only solution that I could come up with would be to run In practical terms, my proposal would be to modify this logic so that all * For example, consider a plugin that listens to a |
I second @fmarotta's interpretation, however I propose a slight extension to what is mentioned in his post. Two motivations:
To address both, I suggest that:
The above would ensure two calls to the same function in the same plugin are queued together. This should hopefully make it more predictable for the developer of the plugin, while at the same time avoiding interference from other plugins. As for This would then mean that:
This however glances over thread safety, which we will need to assess separately. It may very well be that Python's GIL keep us safe but we'll need to see how it scales and what context needs to be shared/passed. |
I agree with the direction this discussion is headed. Making either of the changes described should be considered "breaking" changes and would warrant stepping the major version of mmpy_bot. I really like the idea of preventing individual plugins from blocking the |
Hi,
The bot is unable to handle asyncio concurrent messagefunction calls. If you add sleep to any listen function - the bot will be unable to handle any other messages until the sleep is released.
Here is an example. If you type !test to the bot it will enter the function test and sleep for 5 seconds. If during those 5 seconds you tell the bot !hi it won't reply to you until the !test function is released.
Expected functionality would be ability to handle multiple requests concurrently
The text was updated successfully, but these errors were encountered: