Closed nejch closed 2 years ago
Thanks @nejch, nice work!
@mikitex70 sorry to bother you again, we would love to see this feature released soon as we have issues with a server enabled this "rate limit" and we have broken rendered pictures.
We are investigating a solution to use another server without the "rate limit", but may be new plantuml-markdown is already planed.
I'm at work now, I'll release it tonight.
Hi @nejch, I've just released the 3.7.2
which includes your PR.
Excuse me for the delay, I did not understand that it was an urgent problem for you.
Thanks a lot @mikitex70 for the quick merge and release, and no worries! I did not either, until this morning when our users started reporting more issues :sweat_smile:
Sometimes plantuml or kroki servers are behind reverse proxies/gateways that have rate limits in place, or may experience intermittent connection issues. The extension might fail when many diagrams are rendered because it makes too many burst requests.
This adds a custom keep-alive session for making requests in
_render_remote_uml_image
to retry a few times and respect rate-limit headers (e.g. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429).More context: https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry https://stackoverflow.com/questions/23267409/how-to-implement-retry-mechanism-into-python-requests-library
@mikitex70 I haven't added a config option here and just enabled it by default, but if you think it's necessary I can add one.