So, I read up about stale_while_revalidate
# https://requests-cache.readthedocs.io/en/stable/user_guide/expiration.html#asynchronous-revalidation
stale_while_revalidate=True,
And at some point got pool size warnings:
WARNING Connection pool is full, discarding connection: 192-168-x-y.[redacted].plex.direct. Connection pool size: 10
WARNING Connection pool is full, discarding connection: 192-168-x-y.[redacted].plex.direct. Connection pool size: 10
WARNING Connection pool is full, discarding connection: 192-168-x-y.[redacted].plex.direct. Connection pool size: 10
so, I dug up some code:
|
def _resend_async(self, *args, **kwargs): |
|
"""Send a non-blocking request to refresh a cached response""" |
|
logger.debug('Using stale response while revalidating') |
|
thread = Thread(target=self._send_and_cache, args=args, kwargs=kwargs) |
|
thread.start() |
and that code immediately raised me questions:
- there's no control of how many threads can be created
- there's no method to wait for the background threads to be finished
So, I read up about
stale_while_revalidateAnd at some point got pool size warnings:
so, I dug up some code:
requests-cache/requests_cache/session.py
Lines 295 to 299 in 2c143a3
and that code immediately raised me questions: