[backend/streaming] Don't send notes older than a 5 minutes to home timeline streams

This fixes the issue where when older notes get ingested through ways other than direct federation, they don't erroneously appear at the top of the home timeline.
This commit is contained in:
Laura Hausmann 2024-04-28 19:45:32 +02:00
parent a7898e8aa9
commit 78e47c3236
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 3 additions and 2 deletions

View file

@ -107,6 +107,7 @@ public class UserChannel(WebSocketConnection connection, bool notificationsOnly)
var wrapped = IsApplicable(note);
if (wrapped == null) return;
if (IsFiltered(note)) return;
if (note.CreatedAt < DateTime.UtcNow - TimeSpan.FromMinutes(5)) return;
await using var scope = connection.ScopeFactory.CreateAsyncScope();
var renderer = scope.ServiceProvider.GetRequiredService<NoteRenderer>();

View file

@ -236,10 +236,10 @@ public sealed class StreamingConnectionAggregate : IDisposable
if (note.UserHost == null)
timelines.Add(StreamingTimeline.Local);
if (IsFollowingOrSelf(note.User))
if (IsFollowingOrSelf(note.User) && note.CreatedAt > DateTime.UtcNow - TimeSpan.FromMinutes(5))
timelines.Add(StreamingTimeline.Home);
}
else
else if (note.CreatedAt > DateTime.UtcNow - TimeSpan.FromMinutes(5))
{
// We already enumerated _following in IsApplicable()
timelines.Add(StreamingTimeline.Home);