transitions icon indicating copy to clipboard operation
transitions copied to clipboard

asyncio: Fix setting AsyncTimeout._on_timeout trigger, when timeout=0

Open Rysbai opened this issue 2 years ago • 0 comments

Bug description

I wanted to initialise AsyncTimeout state with timeout=0, so I can set timeout after initialisation before/after entering state. But trigger is not called after setting timeout > 0, entering the state and timeout has passed.

So in my project, I set on_timeout along with the timeout before entering to state and it's working.

Root cause analyse result

AsyncTimeout._on_timeout is a list of triggers and there is a on_timeout setter that listifies value before setting. AsyncTimeout.__init__ uses setter if timeout > 0, but it passes directly if timeout = 0.

Rysbai avatar Jul 05 '22 07:07 Rysbai