Ken
Ken

Reputation: 63

Truncate feeds in getStream

I would like to limit the number of feed updates (records) in my GetStream app. I want to keep each feed at a constant length of 500 items.

I make heavy use of the 'to:' field, which results in a lot of feeds of different lengths. I want them all to grow to 500 items, so I would rather not remove items by date.

For what it's worth, I store all the updates in my own database which results in a replica of the network activity.

What would be a good way of keeping my feeds short?

Upvotes: 1

Views: 296

Answers (1)

Ken Hoff
Ken Hoff

Reputation: 247

There's no straightforward way to limit your feeds to 500 items. There's 2 ways to remove activities from Stream:

  • the removeActivity method, which will remove 1 activity at a time via the foreign_id or activity id (https://getstream.io/docs/js/#removing-activities)
  • the "Truncate Data" button on the dashboard for your app, which will remove all activities in Stream.

It might be possible to get the behavior you're looking for by keeping track of all activities that you're adding to Stream, then periodically culling the ones that put you over 500.

Hopefully this helps!

Upvotes: 2

Related Questions