Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issues based on setting #944

Open
gbtota opened this issue Jan 20, 2024 · 0 comments
Open

Performance issues based on setting #944

gbtota opened this issue Jan 20, 2024 · 0 comments
Labels

Comments

@gbtota
Copy link

gbtota commented Jan 20, 2024

The problem

performance difference when setting the initial values to positive or negative on the session

Example when i set the "expire_after=EXPIRE_IMMEDIATELY" or "expire_after=1" on the session and then a specific request to expire_after=5000; then i make 1k requests , the pages per second loads using tdqm is slow like 20 iterations/second.

However "expire_after=-1" or "expire_after=None" on the session; and try the same long cache 1k requests with speeds being 400 iterations/second.

however if set this to -1 in session the long cache requests work but it seems to break no cache requests and makes them cache and not update as needed; setting refresh=True doesnt seem to help . seems like once i apply expire_after=5000; it retains it and ignores the setting next time i apply expire_after=1;

Expected behavior

when setting the expire_after= in the main session the performance is expected to be consistent

Steps to reproduce the behavior

i set the session variable for most requests but want to be able to modify/extend the cache for specific sets of request.
Example:
SESSION = CachedSession('request_cache',expire_after=EXPIRE_IMMEDIATELY,backend=SQLiteCache(use_memory=True),allowable_codes=[200],allowable_methods=['GET', 'PATCH'],stale_if_error=True) #

Slow when setting specific values on a particular request :
SESSION.get(url, params=payload,expire_after=5000)

Workarounds

none

Environment

  • requests-cache version: (1.1.0)
  • Python version: : - 3.11
  • Platform:: - windows 11
@gbtota gbtota added the bug label Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant