-
-
Notifications
You must be signed in to change notification settings - Fork 14
Description
The general structure of the on_
modifier might lead to race condition, in particular if the underlying tasks have wait-like mechanism (ex: using time.sleep
).
The state's documentation does mention part of the risk: https://github.com/ApeWorX/silverback/blob/main/docs/userguides/development.md#bot-state
You can use
bot.state
to store any python variable type, however note that the item is not networked nor threadsafe so it is not recommended to have multiple tasks write to the same value in state at the same time.
However I believe this should be highlighted more clearly, in particular given that some internals of ape might create unintended race condition risks (ex: bot.nonce
)
(note: I can make a first stab in a PR, but I wanted to get early feedback first )