Skip to content

Commit

Permalink
Merge branch 'malthejorgensen-fix-results-cache-size-setting'
Browse files Browse the repository at this point in the history
Fix RESULTS_CACHE_SIZE setting. Merged #672.
  • Loading branch information
tim-schilling committed Feb 26, 2015
2 parents 1cd10a9 + 78db97b commit 2cbd2e6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion debug_toolbar/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'INSERT_BEFORE': '</body>',
'JQUERY_URL': '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js',
'RENDER_PANELS': None,
'RESULTS_STORE_SIZE': 10,
'RESULTS_CACHE_SIZE': 10,
'ROOT_TAG_EXTRA_ATTRS': '',
'SHOW_COLLAPSED': False,
'SHOW_TOOLBAR_CALLBACK': 'debug_toolbar.middleware.show_toolbar',
Expand Down
2 changes: 1 addition & 1 deletion debug_toolbar/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def store(self):
self.store_id = uuid.uuid4().hex
cls = type(self)
cls._store[self.store_id] = self
for _ in range(len(cls._store) - self.config['RESULTS_STORE_SIZE']):
for _ in range(len(cls._store) - self.config['RESULTS_CACHE_SIZE']):
try:
# collections.OrderedDict
cls._store.popitem(last=False)
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Toolbar options
right thing depending on whether the WSGI container runs multiple processes.
This setting allows you to force a different behavior if needed.

* ``RESULTS_STORE_SIZE``
* ``RESULTS_CACHE_SIZE``

Default: ``10``

Expand Down Expand Up @@ -191,7 +191,7 @@ Here's what a slightly customized toolbar configuration might look like::
# This example is unlikely to be appropriate for your project.
CONFIG_DEFAULTS = {
# Toolbar options
'RESULTS_STORE_SIZE': 3,
'RESULTS_CACHE_SIZE': 3,
'SHOW_COLLAPSED': True,
# Panel options
'SQL_WARNING_THRESHOLD': 100, # milliseconds
Expand Down
2 changes: 1 addition & 1 deletion docs/tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ setting.
By default, data gathered during the last 10 requests is kept in memory. This
allows you to use the toolbar on a page even if you have browsed to a few
other pages since you first loaded that page. You can reduce memory
consumption by setting the ``RESULTS_STORE_SIZE`` configuration option to a
consumption by setting the ``RESULTS_CACHE_SIZE`` configuration option to a
lower value. At worst, the toolbar will tell you that the data you're looking
for isn't available anymore.

Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_basic(self):
self.assertIn("Name", table.text)
self.assertIn("Version", table.text)

@override_settings(DEBUG_TOOLBAR_CONFIG={'RESULTS_STORE_SIZE': 0})
@override_settings(DEBUG_TOOLBAR_CONFIG={'RESULTS_CACHE_SIZE': 0})
def test_expired_store(self):
self.selenium.get(self.live_server_url + '/regular/basic/')
version_panel = self.selenium.find_element_by_id('VersionsPanel')
Expand Down

0 comments on commit 2cbd2e6

Please sign in to comment.