Merge lp:~robru/friends/lp_1154520 into lp:friends

Proposed by Robert Bruce Park
Status: Merged
Approved by: Ken VanDine
Approved revision: 167
Merged at revision: 166
Proposed branch: lp:~robru/friends/lp_1154520
Merge into: lp:friends
Diff against target: 54 lines (+14/-5)
2 files modified
friends/main.py (+13/-5)
friends/tests/test_flickr.py (+1/-0)
To merge this branch: bzr merge lp:~robru/friends/lp_1154520
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+154549@code.launchpad.net

Commit message

Safely ignore the release of an unlocked lock. (LP: #1154520)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:166
http://jenkins.qa.ubuntu.com/job/friends-ci/8/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/friends-raring-amd64-ci/8/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/friends-ci/8/rebuild

review: Needs Fixing (continuous-integration)
lp:~robru/friends/lp_1154520 updated
167. By Robert Bruce Park

Make Flickr tests start with fresh state.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:167
http://jenkins.qa.ubuntu.com/job/friends-ci/9/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/friends-raring-amd64-ci/9

Click here to trigger a rebuild:
http://s-jenkins:8080/job/friends-ci/9/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) :
review: Approve

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-03-20 01:24:15 +0000
3+++ friends/main.py 2013-03-21 00:00:32 +0000
4@@ -75,6 +75,13 @@
5 log = None
6
7
8+# We need to acquire the publish lock so that the dispatcher
9+# doesn't try to publish rows into an uninitialized model...
10+# basically this prevents duplicates from showing up.
11+# We release this lock later, once the model is synchronized.
12+_publish_lock.acquire()
13+
14+
15 def main():
16 global log
17 global yappi
18@@ -126,10 +133,6 @@
19 'private',
20 )
21
22- # We need to acquire the publish lock so that the dispatcher
23- # doesn't try to publish rows into an uninitialized model...
24- # basically this prevents duplicates from showing up.
25- _publish_lock.acquire()
26 Dispatcher(gsettings, loop)
27
28 # Don't initialize caches until the model is synchronized
29@@ -165,7 +168,12 @@
30 initialize_caches()
31
32 # Allow publishing.
33- _publish_lock.release()
34+ try:
35+ _publish_lock.release()
36+ except RuntimeError:
37+ # Happens if the lock was already released previously, which
38+ # is safe to ignore. Dispatcher goes on to publish normally.
39+ pass
40
41
42 if __name__ == '__main__':
43
44=== modified file 'friends/tests/test_flickr.py'
45--- friends/tests/test_flickr.py 2013-03-14 19:14:03 +0000
46+++ friends/tests/test_flickr.py 2013-03-21 00:00:32 +0000
47@@ -42,6 +42,7 @@
48 self.protocol._get_oauth_headers = lambda *ignore, **kwignore: {}
49 self.log_mock = LogMock('friends.utils.base',
50 'friends.protocols.flickr')
51+ TestModel.clear()
52
53 def tearDown(self):
54 self.log_mock.stop()

Subscribers

People subscribed via source and target branches