vutran1710 / PyrateLimiter

⚔️Python Rate-Limiter using Leaky-Bucket Algorithm Family
https://pyratelimiter.readthedocs.io
MIT License
327 stars 35 forks source link

on Windows, Limiter() constructor hangs after gevent monkeypatch #167

Open gonewest818 opened 4 months ago

gonewest818 commented 4 months ago

As the subject says, specifically on Windows this hangs indefinitely:

import gevent.monkey
gevent.monkey.patch_all()

from pyrate_limiter import Duration, Rate, Limiter

rate = Rate(5, Duration.SECOND * 2)
limiter = Limiter(rate)

Reproduced on Windows 11, using pyenv to install python 3.10, 3.11 and 3.12.

vutran1710 commented 4 months ago

Were you trying to unit-test the limiter or something? What version were you using? And Limiter only accepts a list of rates, not a single rate like in your example.

gonewest818 commented 4 months ago

No, this is the smallest repro of what I'm seeing in a larger system. I narrowed it down to literally the QuickStart example on your README except with the monkeypatching inserted first.

Oh, sorry, your other questions:

I also cut down the python virtual environment to the bare minimum, it's literally just

Package        Version
-------------- -------
cffi           1.16.0
gevent         24.2.1
greenlet       3.0.3
pip            24.0
pycparser      2.21
pyrate-limiter 3.6.0
setuptools     69.2.0
zope.event     5.0
zope.interface 6.2