the-algorithm/pushservice/src/main/scala/com/twitter/frigate/pushservice/store/LexServiceStore.scala
twitter-team b389c3d302 Open-sourcing pushservice
Pushservice is the main recommendation service we use to surface recommendations to our users via notifications. It fetches candidates from various sources, ranks them in order of relevance, and applies filters to determine the best one to send.
2023-05-19 16:27:07 -05:00

27 lines
911 B
Scala

package com.twitter.frigate.pushservice.store
import com.twitter.livevideo.common.ids.EventId
import com.twitter.livevideo.timeline.client.v2.LiveVideoTimelineClient
import com.twitter.livevideo.timeline.domain.v2.Event
import com.twitter.livevideo.timeline.domain.v2.LookupContext
import com.twitter.stitch.storehaus.ReadableStoreOfStitch
import com.twitter.stitch.NotFound
import com.twitter.stitch.Stitch
import com.twitter.storehaus.ReadableStore
case class EventRequest(eventId: Long, lookupContext: LookupContext = LookupContext.default)
object LexServiceStore {
def apply(
liveVideoTimelineClient: LiveVideoTimelineClient
): ReadableStore[EventRequest, Event] = {
ReadableStoreOfStitch { eventRequest =>
liveVideoTimelineClient.getEvent(
EventId(eventRequest.eventId),
eventRequest.lookupContext) rescue {
case NotFound => Stitch.NotFound
}
}
}
}