summaryrefslogtreecommitdiff
path: root/tools/commitfest/update_archive_threads.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/commitfest/update_archive_threads.py')
-rwxr-xr-xtools/commitfest/update_archive_threads.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/tools/commitfest/update_archive_threads.py b/tools/commitfest/update_archive_threads.py
index d32ea1c..19dd221 100755
--- a/tools/commitfest/update_archive_threads.py
+++ b/tools/commitfest/update_archive_threads.py
@@ -19,7 +19,7 @@ django.setup()
from django.db import connection
from pgcommitfest.commitfest.models import MailThread
-from pgcommitfest.commitfest.ajax import _archivesAPI, parse_and_add_attachments
+from pgcommitfest.commitfest.ajax import refresh_single_thread
if __name__ == "__main__":
debug = "--debug" in sys.argv
@@ -32,22 +32,7 @@ if __name__ == "__main__":
logging.debug("Checking for updated mail threads in the archives")
for thread in MailThread.objects.filter(patches__commitfests__status__in=(1,2,3)).distinct():
logging.debug("Checking %s in the archives" % thread.messageid)
- r = sorted(_archivesAPI('/message-id.json/%s' % thread.messageid), key=lambda x: x['date'])
- if thread.latestmsgid != r[-1]['msgid']:
- # There is now a newer mail in the thread!
- logging.info("Thread %s updated" % thread.messageid)
- thread.latestmsgid = r[-1]['msgid']
- thread.latestmessage = r[-1]['date']
- thread.latestauthor = r[-1]['from']
- thread.latestsubject = r[-1]['subj']
- thread.save()
- parse_and_add_attachments(r, thread)
- # Potentially update the last mail date - if there wasn't already a mail on each patch
- # from a *different* thread that had an earlier date.
- for p in thread.patches.filter(lastmail__lt=thread.latestmessage):
- logging.debug("Last mail time updated for %s" % thread.messageid)
- p.lastmail = thread.latestmessage
- p.save()
+ refresh_single_thread(thread)
connection.close()
logging.debug("Done.")