mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 19:57:43 +00:00
be more forgiving with comment age
This commit is contained in:
parent
cd8b0b0dca
commit
9154ee8e7f
1 changed files with 15 additions and 4 deletions
|
@ -227,10 +227,21 @@ func (lac *liveActivitiesConsumer) Consume(delivery rmq.Delivery) {
|
||||||
|
|
||||||
// Filter out comments in the last minute
|
// Filter out comments in the last minute
|
||||||
candidates := make([]*reddit.Thing, 0)
|
candidates := make([]*reddit.Thing, 0)
|
||||||
cutoff := now.Add(-domain.LiveActivityCheckInterval)
|
cutoffs := []time.Time{
|
||||||
for _, t := range tr.Children {
|
now.Add(-domain.LiveActivityCheckInterval),
|
||||||
if t.CreatedAt.After(cutoff) {
|
now.Add(-domain.LiveActivityCheckInterval * 2),
|
||||||
candidates = append(candidates, t)
|
now.Add(-domain.LiveActivityCheckInterval * 4),
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, cutoff := range cutoffs {
|
||||||
|
for _, t := range tr.Children {
|
||||||
|
if t.CreatedAt.After(cutoff) {
|
||||||
|
candidates = append(candidates, t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(candidates) > 0 {
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue