Merge lp:~robru/friends/early-dbus-interface into lp:friends

Proposed by Robert Bruce Park
Status: Merged
Merged at revision: 157
Proposed branch: lp:~robru/friends/early-dbus-interface
Merge into: lp:friends
Diff against target: 53 lines (+14/-6)
1 file modified
friends/main.py (+14/-6)
To merge this branch: bzr merge lp:~robru/friends/early-dbus-interface
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+151317@code.launchpad.net

Description of the change

Bring up the DBus interface much sooner in the init process, no longer waiting for the model to sync before starting to listen for dbus methods.

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) wrote :

Wow, I've only been running this for four hours, but so far it has completely obliterated all the timeout warnings I used to see. Really curious to see what this looks like for you, Ken.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'friends/main.py'
2--- friends/main.py 2013-02-20 13:08:27 +0000
3+++ friends/main.py 2013-03-01 20:32:21 +0000
4@@ -57,10 +57,11 @@
5 GObject.threads_init(None)
6
7 from friends.service.dispatcher import Dispatcher, DBUS_INTERFACE
8+from friends.utils.base import _OperationThread, _publish_lock
9+from friends.utils.base import Base, initialize_caches
10+from friends.utils.model import Model, prune_model
11+from friends.utils.logging import initialize
12 from friends.utils.avatar import Avatar
13-from friends.utils.base import _OperationThread, Base, initialize_caches
14-from friends.utils.logging import initialize
15-from friends.utils.model import Model, prune_model
16
17
18 # Optional performance profiling module.
19@@ -126,8 +127,14 @@
20 'private',
21 )
22
23+ # We need to acquire the publish lock so that the dispatcher
24+ # doesn't try to publish rows into an uninitialized model...
25+ # basically this prevents duplicates from showing up.
26+ _publish_lock.acquire()
27+ Dispatcher(gsettings, loop)
28+
29 # Don't initialize caches until the model is synchronized
30- Model.connect('notify::synchronized', setup, gsettings, loop)
31+ Model.connect('notify::synchronized', setup)
32
33 try:
34 log.info('Starting friends-dispatcher main loop')
35@@ -140,7 +147,7 @@
36 yappi.print_stats(sys.stdout, yappi.SORTTYPE_TTOT)
37
38
39-def setup(model, param, gsettings, loop):
40+def setup(model, param):
41 """Continue friends-dispatcher init after the DeeModel has synced."""
42 # mhr3 says that we should not let a Dee.SharedModel exceed 8mb in
43 # size, because anything larger will have problems being transmitted
44@@ -156,7 +163,8 @@
45 # data for the purposes of faster duplicate checks.
46 initialize_caches()
47
48- Dispatcher(gsettings, loop)
49+ # Allow publishing.
50+ _publish_lock.release()
51
52
53 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches