dedup all timeline notifications - closes #9686
parent
d57e4c5816
commit
0d25823e5e
|
@ -50,7 +50,7 @@ final class Env(
|
|||
}
|
||||
}
|
||||
|
||||
system.actorOf(Props(wire[Push]), name = config.userActorName)
|
||||
system.actorOf(Props(wire[TimelinePush]), name = config.userActorName)
|
||||
|
||||
lila.common.Bus.subscribeFun("shadowban") { case lila.hub.actorApi.mod.Shadowban(userId, true) =>
|
||||
entryApi.removeRecentFollowsBy(userId).unit
|
||||
|
|
|
@ -2,6 +2,7 @@ package lila.timeline
|
|||
|
||||
import akka.actor._
|
||||
import org.joda.time.DateTime
|
||||
import scala.concurrent.duration._
|
||||
|
||||
import lila.common.config.Max
|
||||
import lila.hub.actorApi.timeline.propagation._
|
||||
|
@ -9,7 +10,7 @@ import lila.hub.actorApi.timeline.{ Atom, Propagate, ReloadTimelines }
|
|||
import lila.security.Permission
|
||||
import lila.user.{ User, UserRepo }
|
||||
|
||||
final private[timeline] class Push(
|
||||
final private[timeline] class TimelinePush(
|
||||
relationApi: lila.relation.RelationApi,
|
||||
userRepo: UserRepo,
|
||||
entryApi: EntryApi,
|
||||
|
@ -18,8 +19,10 @@ final private[timeline] class Push(
|
|||
|
||||
implicit def ec = context.dispatcher
|
||||
|
||||
private val dedup = lila.memo.OnceEvery.hashCode[Atom](10 minutes)
|
||||
|
||||
def receive = { case Propagate(data, propagations) =>
|
||||
propagate(propagations) flatMap { users =>
|
||||
if (dedup(data)) propagate(propagations) flatMap { users =>
|
||||
unsubApi.filterUnsub(data.channel, users)
|
||||
} foreach { users =>
|
||||
if (users.nonEmpty)
|
Loading…
Reference in New Issue