trio-asyncio icon indicating copy to clipboard operation
trio-asyncio copied to clipboard

AssertionError, assert delay >= 0, delay

Open mstarodub opened this issue 3 months ago • 0 comments

import trio
import trio_asyncio
from trio_asyncio import aio_as_trio as a2t
from curl_cffi import requests as ccr
from aioresult import ResultCapture

urls = [
  'https://google.com/',
  'https://facebook.com/',
  'https://twitter.com/',
]


async def main():
  async with a2t(ccr.AsyncSession()) as session:
    async with trio.open_nursery() as nursery:
      results = [
        ResultCapture.start_soon(nursery, a2t(session.get), url) for url in urls
      ]

  for r in results:
    resp = r.result()
    print(resp.url, resp.status_code, len(resp.text))


trio_asyncio.run(main)

gives

Exception ignored from cffi callback <function timer_function at 0x1038ed9e0>:
Traceback (most recent call last):
  File ".venv/lib/python3.13/site-packages/curl_cffi/aio.py", line 131, in timer_function
    async_curl._timer = async_curl.loop.call_later(
  File ".venv/lib/python3.13/site-packages/trio_asyncio/_base.py", line 367, in call_later
    assert delay >= 0, delay
AssertionError: -0.001
https://www.google.com/ 200 50051
https://www.facebook.com/unsupportedbrowser 200 152403
https://x.com/ 200 221313

related to #153

mstarodub avatar Sep 26 '25 13:09 mstarodub