From: Anders Kaseorg Date: Fri, 6 Mar 2009 22:16:02 +0000 (-0500) Subject: Workaround for mechanize memory leaks. X-Git-Url: http://andersk.mit.edu/gitweb/jira-zephyrbot.git/commitdiff_plain/a75c8c0f8344e2caf9b620a329ea528c19cb5504 Workaround for mechanize memory leaks. --- diff --git a/jirabot.py b/jirabot.py index 2fee41d..2830167 100755 --- a/jirabot.py +++ b/jirabot.py @@ -122,6 +122,8 @@ def zerror(msg): b = jira_init() zephyr.init() +count = 0 + while True: time_file_new = time_file + '.' + ''.join(random.sample(string.letters, 8)) @@ -132,11 +134,17 @@ while True: time.sleep(17) continue + if (count >= 200): + b = jira_init() + count = 0 + count += 1 + 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() + b.clear_history() old_time = int(open(time_file_new).read()) new_time = old_time