[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:
parent
a7898e8aa9
commit
78e47c3236
2 changed files with 3 additions and 2 deletions
|
@ -107,6 +107,7 @@ public class UserChannel(WebSocketConnection connection, bool notificationsOnly)
|
||||||
var wrapped = IsApplicable(note);
|
var wrapped = IsApplicable(note);
|
||||||
if (wrapped == null) return;
|
if (wrapped == null) return;
|
||||||
if (IsFiltered(note)) return;
|
if (IsFiltered(note)) return;
|
||||||
|
if (note.CreatedAt < DateTime.UtcNow - TimeSpan.FromMinutes(5)) return;
|
||||||
await using var scope = connection.ScopeFactory.CreateAsyncScope();
|
await using var scope = connection.ScopeFactory.CreateAsyncScope();
|
||||||
|
|
||||||
var renderer = scope.ServiceProvider.GetRequiredService<NoteRenderer>();
|
var renderer = scope.ServiceProvider.GetRequiredService<NoteRenderer>();
|
||||||
|
|
|
@ -236,10 +236,10 @@ public sealed class StreamingConnectionAggregate : IDisposable
|
||||||
if (note.UserHost == null)
|
if (note.UserHost == null)
|
||||||
timelines.Add(StreamingTimeline.Local);
|
timelines.Add(StreamingTimeline.Local);
|
||||||
|
|
||||||
if (IsFollowingOrSelf(note.User))
|
if (IsFollowingOrSelf(note.User) && note.CreatedAt > DateTime.UtcNow - TimeSpan.FromMinutes(5))
|
||||||
timelines.Add(StreamingTimeline.Home);
|
timelines.Add(StreamingTimeline.Home);
|
||||||
}
|
}
|
||||||
else
|
else if (note.CreatedAt > DateTime.UtcNow - TimeSpan.FromMinutes(5))
|
||||||
{
|
{
|
||||||
// We already enumerated _following in IsApplicable()
|
// We already enumerated _following in IsApplicable()
|
||||||
timelines.Add(StreamingTimeline.Home);
|
timelines.Add(StreamingTimeline.Home);
|
||||||
|
|
Loading…
Add table
Reference in a new issue