]> andersk Git - jira-zephyrbot.git/commitdiff
Move the locking around the entire loop body.
authorAnders Kaseorg <andersk@mit.edu>
Tue, 17 Feb 2009 21:48:37 +0000 (16:48 -0500)
committerAnders Kaseorg <andersk@mit.edu>
Tue, 17 Feb 2009 21:48:37 +0000 (16:48 -0500)
jirabot.py

index 6198303a2da4efc7fec85f03de4ac05d86fda409..b9b5be481879790ff12062542c3a80cd4be01684 100755 (executable)
@@ -110,12 +110,6 @@ b = jira_init()
 zephyr.init()
 
 while True:
-    jira_login(b)
-    b.open("https://jira.mit.edu/jira/sr/jira.issueviews:searchrequest-rss/temp/SearchRequest.xml?&pid=10185&updated%3Aprevious=-1w&sorter/field=updated&sorter/order=DESC&tempMax=1000")
-    issues_rss = b.response().read()
-    b.open("https://jira.mit.edu/jira/sr/jira.issueviews:searchrequest-comments-rss/temp/SearchRequest.xml?&pid=10185&updated%3Aprevious=-1w&sorter/field=updated&sorter/order=DESC&tempMax=1000")
-    comments_rss = b.response().read()
-
     time_file_new = time_file + '.' + ''.join(random.sample(string.letters, 8))
 
     try:
@@ -125,6 +119,12 @@ while True:
         time.sleep(17)
         continue
 
+    jira_login(b)
+    b.open("https://jira.mit.edu/jira/sr/jira.issueviews:searchrequest-rss/temp/SearchRequest.xml?&pid=10185&updated%3Aprevious=-1w&sorter/field=updated&sorter/order=DESC&tempMax=1000")
+    issues_rss = b.response().read()
+    b.open("https://jira.mit.edu/jira/sr/jira.issueviews:searchrequest-comments-rss/temp/SearchRequest.xml?&pid=10185&updated%3Aprevious=-1w&sorter/field=updated&sorter/order=DESC&tempMax=1000")
+    comments_rss = b.response().read()
+
     old_time = int(open(time_file_new).read())
     new_time = old_time
 
@@ -133,9 +133,10 @@ while True:
 
     open(time_file_new, 'w').write(str(new_time))
 
-    os.rename(time_file_new, time_file)
-
     zephyrs.sort(key=lambda tz: tz[0])
     for (t, z) in zephyrs:
         z.send()
+
+    os.rename(time_file_new, time_file)
+
     time.sleep(60)
This page took 0.084401 seconds and 5 git commands to generate.