Merge lp:~robru/friends/persistence into lp:friends
| Status: | Merged |
|---|---|
| Merged at revision: | 19 |
| Proposed branch: | lp:~robru/friends/persistence |
| Merge into: | lp:friends |
| Diff against target: |
543 lines (+254/-31) 11 files modified
friends/main.py (+16/-0) friends/service/dispatcher.py (+10/-0) friends/tests/test_download.py (+1/-1) friends/tests/test_flickr.py (+2/-2) friends/tests/test_model.py (+68/-2) friends/tests/test_protocols.py (+53/-5) friends/tests/test_twitter.py (+11/-11) friends/utils/base.py (+41/-2) friends/utils/download.py (+0/-1) friends/utils/model.py (+48/-2) tools/debug_live.py (+4/-5) |
| To merge this branch: | bzr merge lp:~robru/friends/persistence |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Bruce Park | Approve on 2012-10-18 | ||
| Barry Warsaw | 2012-10-16 | Pending | |
| Ken VanDine | 2012-10-16 | Pending | |
|
Review via email:
|
|||
Description of the Change
This implements the Dee.ResourceManager for persisting our Dee.SharedModel across instances of friends-service.
So, the important thing is that this *works*. I confirmed it with debug_live.py script. You can run './tools/
That said, I don't know what kind of performance implications this has. Probably this is going to make friends-service very slow to launch once there are lots of rows in the Model. We should consider some kind of row-expiry logic, dropping rows after they are older than some certain threshold. Or maybe just putting a hard limit on the number of rows that we'll allow and then deleting the oldest of the rows when that limit is exceeded. Somebody who knows more about Dee should decide what the maximum number of rows should be before we can expect performance to become an issue.
barry: I don't know how to write a test for this. Maybe TestDbus could be expanded to invoke friends-service, close it, invoke it again, and test that Model rows are still there? I don't know what that would look like.
kenvandine: when you ping mhr3 about this, please show him this mp so he can see what we're trying to do.
- 8. By Robert Bruce Park on 2012-10-18
-
Add test case for _initialize_caches, and some cleanup.
- 9. By Robert Bruce Park on 2012-10-18
-
Stop persisting an unchanged model at launch.
Previously the code was unconditionally saving the Model to disk
immediately after loading it, even if there were no changes.Now, we will save an empty model to disk at launch only if a) there
was no model saved before, or b) the schema has changed since the last
run, invalidating all existing data. - 10. By Robert Bruce Park on 2012-10-18
-
Add a test case for persist_model function.
- 11. By Robert Bruce Park on 2012-10-20
-
Merged trunk.
- 12. By Robert Bruce Park on 2012-10-20
-
Add row expiry logic.
- 13. By Robert Bruce Park on 2012-10-20
-
Add test coverage for model pruning functionality.
- 14. By Robert Bruce Park on 2012-10-20
-
Move prune_model and initialize_caches calls into main.py
The reason for this is that a) defining a function only to call it
immediately is slightly goofy, and b) this gives main.py finer-grained
control on startup tasks, freeing us from import side-effects that
could potentially break if we had the wrong import order. - 15. By Robert Bruce Park on 2012-10-22
-
Use Model.insert_sorted instead of Model.append, sorting by timestamp.
This makes it easier to delete oldest rows when pruning.
- 16. By Robert Bruce Park on 2012-10-22
-
Merged lp:friends
- 17. By Robert Bruce Park on 2012-10-23
-
Fix SharedModel sorting, thanks to mhr3.
Apparently you can't cmp() a GLib.Variant the way you would expect to
do so with a string, so you have to .get_string() from the Variant
first.This commit also adds tests for _cmp and _cmp_date, and also fixes up
a bunch of other tests which were broken by the model data being sorted. - 18. By Robert Bruce Park on 2012-10-23
-
Pyflakes cleanup.
- 19. By Robert Bruce Park on 2012-10-23
-
Prevent Dispatcher.Refresh from pointlessly saving the Model at launch.
- 20. By Robert Bruce Park on 2012-10-23
-
Merged lp:friends.

Alright, this is tested and working. Please merge ;-)