aio-libs/async-timeout

shift_by replaces delay

moznuy opened this issue · 1 comments

Is shift_by meant to increase delay or replace delay. This raises TimeoutError after the 1st second:

import asyncio

from async_timeout import timeout


async def test():
    async with timeout(10) as cm:
        cm.shift_by(1)  # add another second on waiting
        await asyncio.sleep(5)


if __name__ == '__main__':
    asyncio.run(test())

Right now shift_by shifts to self._loop.time() + delay which replaces previous delay with a delay relative to current, not previously defined, time. Is this the expected behavior?

python 3.8.5
async-timeout 4.0.0a3

Thanks for the report.
Fixed by #253