Merge lp:~slimey/engage/vauxhall into lp:engage

Proposed by Simon C
Status: Merged
Approved by: Martin Morrison
Approved revision: 10
Merged at revision: 9
Proposed branch: lp:~slimey/engage/vauxhall
Merge into: lp:engage
Diff against target: 56 lines (+16/-3)
3 files modified
debian/changelog (+6/-0)
setup.py (+1/-1)
src/engage/util/atv.py (+9/-2)
To merge this branch: bzr merge lp:~slimey/engage/vauxhall
Reviewer Review Type Date Requested Status
Martin Morrison Approve
Review via email: mp+131742@code.launchpad.net

Commit message

- Fix getting stuck if connection drops, and release as 0.7.0

Description of the change

- fix getting stuck if connection drops
- stable enough to release as 0.7.0

To post a comment you must log in.
Revision history for this message
Martin Morrison (isoschiz) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-10-05 17:45:59 +0000
3+++ debian/changelog 2012-10-27 15:42:20 +0000
4@@ -1,3 +1,9 @@
5+engage (0.7.0) precise; urgency=low
6+
7+ * Auto-refresh HTTP connection every couple of minutes
8+
9+ -- Simon C <simonc@ensoft.co.uk> Sat, 27 Oct 2012 16:33:27 +0100
10+
11 engage (0.6.4) lucid; urgency=low
12
13 * Fix bug with lucid version of python snmp package
14
15=== modified file 'setup.py'
16--- setup.py 2012-10-05 17:45:59 +0000
17+++ setup.py 2012-10-27 15:42:20 +0000
18@@ -7,7 +7,7 @@
19 from distutils.core import setup
20
21 setup(name='engage',
22- version="0.6.4",
23+ version="0.7.0",
24 description='EnGage: system/network statistics monitoring and Apple TV control',
25 url='http://open.ensoft.co.uk/EnGage',
26 packages=['engage', 'engage.collector', 'engage.media', 'engage.monitor',
27
28=== modified file 'src/engage/util/atv.py'
29--- src/engage/util/atv.py 2012-10-01 20:36:37 +0000
30+++ src/engage/util/atv.py 2012-10-27 15:42:20 +0000
31@@ -2,7 +2,7 @@
32 #
33 # Simon C, September 2012
34
35-import re
36+import re, time
37 from StringIO import StringIO
38 from twisted.internet import defer, reactor
39 from twisted.python import log
40@@ -59,8 +59,15 @@
41 self.http_agent = None
42
43 def _check_connection(self):
44- if self.http_agent is None:
45+ # We don't actually get any disconnection hints from the ATV
46+ # if it stops caring about us for some reason (eg another
47+ # device has taken over). Moreover, it's actually rather hard
48+ # to spot the difference if we drop the http connection
49+ # immediately before creating a new one. So just do that every
50+ # couple of minutes.
51+ if self.http_agent is None or time.time() - self.agent_created > 120:
52 self.http_agent = Agent(reactor, pool=HTTPConnectionPool(reactor))
53+ self.agent_created = time.time()
54
55 def show_photo(self, pathname):
56 self._check_connection()

Subscribers

People subscribed via source and target branches

to all changes: