Skip to content

Improve documentation around race condition #260

@montyly

Description

@montyly

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 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions