Skip to content

Only patch the cache methods once.#2332

Open
tim-schilling wants to merge 1 commit intomainfrom
avoid-over-patching-cache
Open

Only patch the cache methods once.#2332
tim-schilling wants to merge 1 commit intomainfrom
avoid-over-patching-cache

Conversation

@tim-schilling
Copy link
Member

Description

Avoid patching the cache methods multiple times.

Fixes #2330

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.

AI/LLM Usage

  • This PR includes code generated with the help of an AI/LLM

Used claude code to adjust my approach from a sentinel to multiple if statements.

@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  debug_toolbar/panels
  cache.py
Project Total  

This report was generated by python-coverage-comment-action

"decr_version",
]

MONKEY_PATCHED_DISABLED = object()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sentinel value is no longer used.

Confirm that reapplying and disabling the cache patching only wraps
the cache methods once
"""
for _ in range(4000):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need that many here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache panel: cache methods are monkey patched on each request producing a recursion error after ~3K requests

2 participants