1

I have a Rails application that uses GetStream to implement a newsfeed functionality. Everytime a user logs in, the user follows every single location they have access to. The only issue is that a user could possibly belong to 1000+ stores making performance a huge issue.

After setting up the user the first time (the longest time because all follows need to be created), what would be the correct way to prevent duplicate follows? Would it be to set a boolean flag on the user to not follow everytime they log in and only create a new follow each time the user is given access to a new location?

Or maybe GetStream is already smart enough to notice duplicates so it doesn't write each time it receives the same information?

4

1 回答 1

1

Stream 将忽略尝试创建现有关注关系的请求。如果您需要一次创建这么多关注关系,您应该考虑使用关注多批次 API。您可以在文档中找到有关它的更多信息:https ://getstream.io/docs/#batch-follow

于 2016-09-15T08:18:44.650 回答