]> andersk Git - jira-zephyrbot.git/commitdiff
Put the bot into a 60-second loop.
authorAnders Kaseorg <andersk@mit.edu>
Fri, 13 Feb 2009 08:57:05 +0000 (03:57 -0500)
committerAnders Kaseorg <andersk@mit.edu>
Fri, 13 Feb 2009 08:57:05 +0000 (03:57 -0500)
jirabot.py

index 1c646b88eb7cedd1d7271cb55e2154f64ee48410..c2fbf06df2b5c3d105dc34456307fedcd96f420d 100755 (executable)
@@ -104,31 +104,33 @@ def zerror(msg):
     )
 
 b = jira_init()
+zephyr.init()
 
-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()
+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))
+    time_file_new = time_file + '.' + ''.join(random.sample(string.letters, 8))
 
-try:
-    os.rename(time_file, time_file_new)
-except OSError:
-    exit()
+    try:
+        os.rename(time_file, time_file_new)
+    except OSError:
+        exit()
 
-old_time = int(open(time_file_new).read())
-new_time = old_time
+    old_time = int(open(time_file_new).read())
+    new_time = old_time
 
-zephyr.init()
-zephyrs = (feed_to_zephyrs('issue', issues_rss, parse_issue) +
-           feed_to_zephyrs('comment', comments_rss, parse_comment))
+    zephyrs = (feed_to_zephyrs('issue', issues_rss, parse_issue) +
+               feed_to_zephyrs('comment', comments_rss, parse_comment))
 
-open(time_file_new, 'w').write(str(new_time))
+    open(time_file_new, 'w').write(str(new_time))
 
-os.rename(time_file_new, time_file)
+    os.rename(time_file_new, time_file)
 
-zephyrs.sort(key=lambda tz: tz[0])
-for (t, z) in zephyrs:
-    z.send()
+    zephyrs.sort(key=lambda tz: tz[0])
+    for (t, z) in zephyrs:
+        z.send()
+    time.sleep(60)
This page took 0.16699 seconds and 5 git commands to generate.