X-Git-Url: http://andersk.mit.edu/gitweb/jira-zephyrbot.git/blobdiff_plain/4311bd26ba1ffc32fd5c7ba29c1e5479fd36ea25..f719e4334981f765a44a1ed0f5c7c5ab0312c24d:/jirabot.py diff --git a/jirabot.py b/jirabot.py index 1a7edcb..b9b5be4 100755 --- a/jirabot.py +++ b/jirabot.py @@ -68,6 +68,7 @@ def parse_issue(e): return zephyr.ZNotice( sender=zephyr_sender, auth=False, + opcode='auto', cls=zephyr_class, instance=issue, fields=[e.title, msg], @@ -89,6 +90,7 @@ def parse_comment(e): return zephyr.ZNotice( sender=zephyr_sender, auth=False, + opcode='auto', cls=zephyr_class, instance=issue, fields=[e.title, msg], @@ -98,6 +100,7 @@ def zerror(msg): return zephyr.ZNotice( sender=zephyr_sender, auth=False, + opcode='auto', cls=zephyr_class, instance='jira-error', fields=['Jira bot error', msg] @@ -107,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: @@ -122,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 @@ -130,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)