Skip to content

Commit 2fb2dd0

Browse files
committed
Try to fix missing updates
Somehow new emails on a specific patch in production were not being detected. Maybe this will fix it. Patch in question: https://commitfest.postgresql.org/patch/4351/
1 parent 64e4af0 commit 2fb2dd0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pgcommitfest/commitfest/ajax.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,23 @@ def refresh_single_thread(thread):
114114
)
115115
if thread.latestmsgid != r[-1]["msgid"]:
116116
# There is now a newer mail in the thread!
117-
thread.latestmsgid = r[-1]["msgid"]
118-
thread.latestmessage = r[-1]["date"]
119-
thread.latestauthor = r[-1]["from"]
120-
thread.latestsubject = r[-1]["subj"]
121-
thread.save()
122117
parse_and_add_attachments(r, thread)
123118
# Potentially update the last mail date - if there wasn't already a mail on each patch
124119
# from a *different* thread that had an earlier date.
125120
for p in thread.patches.filter(lastmail__lt=thread.latestmessage):
126121
p.lastmail = thread.latestmessage
127122
p.save()
128123

124+
# Finally, we update the thread entry itself. We should only do that at
125+
# the end, in case any of the previous steps fail. Then we'll retry on
126+
# the next run. We could also do this in a transaction, but that would
127+
# mean we lock a bunch of rows for potentially a long time.
128+
thread.latestmsgid = r[-1]["msgid"]
129+
thread.latestmessage = r[-1]["date"]
130+
thread.latestauthor = r[-1]["from"]
131+
thread.latestsubject = r[-1]["subj"]
132+
thread.save()
133+
129134

130135
@transaction.atomic
131136
def annotateMessage(request):

0 commit comments

Comments
 (0)