Merge lp:~brendan-donegan/checkbox/fix_network_sleep_test_never_exits into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Merged at revision: 919
Proposed branch: lp:~brendan-donegan/checkbox/fix_network_sleep_test_never_exits
Merge into: lp:checkbox
Diff against target: 16 lines (+2/-1)
1 file modified
scripts/sleep_test (+2/-1)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/fix_network_sleep_test_never_exits
Reviewer Review Type Date Requested Status
Marc Tardif (community) Approve
Review via email: mp+63562@code.launchpad.net

Description of the change

Original code used:

timedelta(60)

for the time delta between the current time and the start time. This creates a delta of 60 days. Specifying a keyword argument of 'seconds=60' makes sure the delta is specified in seconds.

Also added a short log statement explaining to the user that the scripts is waiting 60 seconds for NetworkManager to re-establish a connection.

To post a comment you must log in.
Revision history for this message
Marc Tardif (cr3) wrote :

Thanks for the fix!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/sleep_test'
2--- scripts/sleep_test 2010-06-22 14:53:01 +0000
3+++ scripts/sleep_test 2011-06-06 15:02:42 +0000
4@@ -337,11 +337,12 @@
5 return True
6
7 start = datetime.now()
8+ logging.debug("Waiting 60 seconds for NetworkManager to reconnect.")
9 while True:
10 if nm.get_state() == nm.STATE_CONNECTED:
11 return True
12 # give 60 seconds to NetworkManager to get to a CONNECTED state, then give up
13- if datetime.now() - start > timedelta(60):
14+ if datetime.now() - start > timedelta(seconds=60):
15 return False
16 sleep(5)
17

Subscribers

People subscribed via source and target branches