修复Medium的For You feed中的重复故事

A few months ago we started getting reports of stories appearing multiple times in the For You feed on Medium mobile apps. See for instance the screenshot below, in which the “Breaking News: Stuff actually costs a lot” story is listed twice:

几个月前,我们开始收到有关Medium移动应用程序上For You Feed中故事出现多次的报告。例如,下面的屏幕截图中,“Breaking News: Stuff actually costs a lot”故事出现了两次:

Instrumentation showed that there were around 4K occurrences per day of duplicate stories on iOS and around 3K occurrences per day on Android. We also received reports of duplicate stories appearing in the For You feed in the web app. So we started investigating.

仪表板显示,iOS上每天大约有4K次重复故事的发生,Android上每天大约有3K次。我们还收到了有关Web应用程序中For You feed中出现重复故事的报告。因此,我们开始调查。

The For You feed under the hood

For You feed的内部机制

Before we dive into how we fixed the issue, let’s take a look at how the For You feed works under the hood.

在我们深入讨论如何修复这个问题之前,让我们先来看看For You feed在内部是如何工作的。

Anatomy of a For You feed request

For You feed请求的结构

In order to retrieve the content of the For You feed, a client app — web, iOS, or Android — performs a request to Medium’s GraphQL API layer. GraphQL then forwards that request to the rex (recommendations) service, implemented in Go, which computes the feed content (with the help of other downstream services) and returns it to GraphQL. GraphQL then forwards the response to the client app. This is summarized in the diagram below (downstream services called by the rex service aren’t represented as they don’t really matter here):

为了检索For You feed的内容,客户端应用程序(Web、iOS或Android)向Medium的GraphQL API层发出请求。然后,GraphQL将该请求转发给使用Go实现的rex(推荐)服务,该服务计算feed内容(借助其他下游服务的帮助)并将其返回给GraphQL。然后,GraphQL将响应转发给客户端应用程序。下图概述了此过程(rex服务调用的下游服务未表示,因为它们在这里并不重要):

Requests to retrieve the For You feed are also paginated, as the feed can contain hundreds of stories. When requesting a page, the client app specifies the maximum number of stories to retrieve and, optionally, the cursor returned in response to the request for the previous page. This cursor is used by the rex service as a way to identify w...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-23 04:49
浙ICP备14020137号-1 $Map of visitor$