lp:django-modeldict

Created by Ricardo Kirkner and last modified
Get this branch:
bzr branch lp:django-modeldict

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Ubuntu One hackers
Project:
django-modeldict
Status:
Development

Import details

Import Status: Reviewed

This branch is an import of the HEAD branch of the Git repository at https://github.com/disqus/django-modeldict.git.

The next import is scheduled to run .

Last successful import was .

Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 10 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 15 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-5 and finished taking 10 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-4 and finished taking 5 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-1 and finished taking 10 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 10 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-5 and finished taking 15 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-5 and finished taking 10 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-1 and finished taking 15 seconds — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-1 and finished taking 10 seconds — see the log

Recent revisions

70. By Kalail <email address hidden>

update README to include related Disqus project

69. By Kalail <email address hidden>

Merge pull request #9 from YPlan/yplan_notice

Add deprecation notice to point to the YPlan fork

68. By David Cramer

1.4.1

67. By Jeff Pollard <email address hidden>

Ship 1.4.0

66. By Jeff Pollard <email address hidden>

Attempt to appease the dependency gods

65. By Jeff Pollard <email address hidden>

Fix bug that caused us to pull down things every time

Summary:
So there was a bug in modeldict that caused the entire switch set to be pulled from cache any time `_cleanup()` was called on the modeldict, which happened every time the `request_finished` and `task_postrun` signals were fired. This was bad, as it means we have a cache `get()` calls to pull down the heavy switch set every single page load and celery task.

The bug happened because `_cleanup()` reset the `_last_checked_for_remote_changes` variable to `None`, effectively clobbering any information that the modeldict had to know what it's own personal `last_modified` timestamp was. Thus, it had no way to know if the remote cache had changed given its version.

Practically, it caused this line of code to be run:

```
return int(cache_last_updated) > self._last_checked_for_remote_changes
```

`cache_last_updated` was the timestamp of the `last_updated` value in remote cache (when the switch set last changed), and `self._last_checked_for_remote_changes` was `None`, reset by `_cleanup()`. No matter what valid `cache_last_updated` value there is, comparing `any_value > None` is always `True`, so the modeldict thought that remote had changes and it pulled them down.

The change was to add a separate `_local_last_updated` instance variable that actually tracked the cached `last_updated` value. This leaves `_last_checked_for_remote_changes` to only be used to track when the modeldict last synced its local cache with the remote one, and to be reset without blowing away the locally cached `last_updated` value.

Test Plan: Existing tests, plus I added another test that asserts when cleanup is called it does not `get()` the whole switch set from the cache.

Reviewers: dcramer, ted

Reviewed By: dcramer

Differential Revision: http://phabricator.local.disqus.net/D4150

64. By Jeff Pollard <email address hidden>

Refactor base.py to be a little easier to follow.

Summary:
My brain was exploding with all the terminology (cache, local_cache, _cache, etc), so I refactored the variable names and whatnot to be a little more semantic.

NOTE: this does **not** fix the cache hit performance regression, but this was a dependency on it to make the logic actually read and make sense.

Test Plan: existing

Reviewers: dcramer

Reviewed By: dcramer

Differential Revision: http://phabricator.local.disqus.net/D4132

63. By Jeff Pollard <email address hidden>

Add .arcconfig

62. By David Cramer

1.3.6

61. By David Cramer

Correct _cleanup comment

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
This branch contains Public information 
Everyone can see this information.