mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-27 21:46:04 +02:00
![twitter-team](/assets/img/avatar_default.png)
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
40 lines
1.3 KiB
Scala
40 lines
1.3 KiB
Scala
package com.twitter.home_mixer.module
|
|
|
|
import com.google.inject.Provides
|
|
import com.twitter.finagle.mtls.authentication.ServiceIdentifier
|
|
import com.twitter.finagle.stats.StatsReceiver
|
|
import com.twitter.inject.TwitterModule
|
|
import com.twitter.timelinemixer.clients.feedback.FeedbackHistoryManhattanClient
|
|
import com.twitter.timelinemixer.clients.feedback.FeedbackHistoryManhattanClientConfig
|
|
import com.twitter.timelines.clients.manhattan.mhv3.ManhattanClientBuilder
|
|
import javax.inject.Singleton
|
|
|
|
object FeedbackHistoryClientModule extends TwitterModule {
|
|
private val ProdDataset = "feedback_history"
|
|
private val StagingDataset = "feedback_history_nonprod"
|
|
|
|
@Provides
|
|
@Singleton
|
|
def providesFeedbackHistoryClient(
|
|
serviceId: ServiceIdentifier,
|
|
statsReceiver: StatsReceiver
|
|
) = {
|
|
val manhattanDataset = serviceId.environment.toLowerCase match {
|
|
case "prod" => ProdDataset
|
|
case _ => StagingDataset
|
|
}
|
|
|
|
val config = new FeedbackHistoryManhattanClientConfig {
|
|
val dataset = manhattanDataset
|
|
val isReadOnly = true
|
|
val serviceIdentifier = serviceId
|
|
}
|
|
|
|
new FeedbackHistoryManhattanClient(
|
|
ManhattanClientBuilder.buildManhattanEndpoint(config, statsReceiver),
|
|
manhattanDataset,
|
|
statsReceiver
|
|
)
|
|
}
|
|
}
|