ApprovalQueue: use a materialized table #240

Merged
Oleg-Komarov merged 4 commits from approval-queue-fix into main 2024-08-23 15:11:46 +02:00
Owner

see #238

This change improves the listing performance: old code had to process all
ApprovalActivity to compute an extension's moderation status and position in
the queue.

Now we maintain a sortkey, a reference to the latest "meaningful" activity
object, and a total comment count. These fields are updated in a post_save
signal.

"Meaningful" activity means moderation status changes:
approved, awaiting changes, awaiting review.

"Non-meaningful" activity shouldn't affect queue position anymore and
extensions without "meaningful" activity should not appear in the queue, but
their respective detail pages should still be reachable via a direct link.
This UX may still need improvement, and #210 may be relevant here.

see #238 This change improves the listing performance: old code had to process all ApprovalActivity to compute an extension's moderation status and position in the queue. Now we maintain a sortkey, a reference to the latest "meaningful" activity object, and a total comment count. These fields are updated in a post_save signal. "Meaningful" activity means moderation status changes: approved, awaiting changes, awaiting review. "Non-meaningful" activity shouldn't affect queue position anymore and extensions without "meaningful" activity should not appear in the queue, but their respective detail pages should still be reachable via a direct link. This UX may still need improvement, and #210 may be relevant here.
Oleg-Komarov added 1 commit 2024-08-23 13:32:35 +02:00
see #238

This change improves the listing performance: old code had to process all
ApprovalActivity to compute an extension's moderation status and position in
the queue.

Now we maintain a sortkey, a reference to the latest "meaningful" activity
object, and a total comment count. These fields are updated in a post_save
signal.

"Meaningful" activity means moderation status changes:
approved, awaiting changes, awaiting review.

"Non-meaningful" activity shouldn't affect queue position anymore and
extensions without "meaningful" activity should not appear in the queue, but
their respective detail pages should still be reachable via a direct link.
This UX may still need improvement, and #210 may be relevant here.
Anna Sirota reviewed 2024-08-23 14:00:04 +02:00
@ -56,0 +59,4 @@
@property
def queue_sortkey(self):
timestamp = int(self.date_created.timestamp())
return (self.STATUS_CHANGE_TYPES[self.type] << 32) | timestamp
Owner

might want to explain what's going on here in a comment :)

might want to explain what's going on here in a comment :)
Oleg-Komarov marked this conversation as resolved
Oleg-Komarov added 2 commits 2024-08-23 14:15:16 +02:00
Oleg-Komarov added 1 commit 2024-08-23 15:09:55 +02:00
Anna Sirota approved these changes 2024-08-23 15:11:28 +02:00
Anna Sirota left a comment
Owner

LGTM 🎉

LGTM :tada:
Oleg-Komarov merged commit 13ac2436ad into main 2024-08-23 15:11:46 +02:00
Oleg-Komarov deleted branch approval-queue-fix 2024-08-23 15:11:47 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/extensions-website#240
No description provided.