summaryrefslogtreecommitdiff
path: root/tools/commitfest
diff options
context:
space:
mode:
authorMagnus Hagander2018-02-21 17:31:54 +0000
committerMagnus Hagander2018-02-21 17:45:19 +0000
commitb8274b5875a4742800307ed645f1137c10e2a09d (patch)
treefd91a0b4b27e7f822c8bedfcf976c5662b152621 /tools/commitfest
parentda4c56069c8f61dd7e8f499827618e527e1a4a1b (diff)
Implement thread notification receiving
This allows the archivs server to ping the CF app to pick up updates to mailthreads quicker.
Diffstat (limited to 'tools/commitfest')
-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.")