Design a service that sends a weekly email digest of the top comments on each post to the post owner.
Requirements:
-
Posts receive comments throughout the week.
-
Once per week, each post owner should receive an email containing the top
N
comments for their post.
-
Comment quality is determined by an external ML scoring service.
-
The ML scoring service is rate-limited and cannot score all comments at once at the end of the week.
-
The system should scale to many posts and comments, tolerate retries and partial failures, and avoid duplicate emails.
Describe the architecture, data model, scheduling strategy, how comments are selected and scored over the course of the week, how to handle ML service rate limits, how final ranking is produced, and how the digest email is generated and delivered reliably.