mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
ef4c5eb65e
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.
24 lines
633 B
Scala
24 lines
633 B
Scala
package com.twitter.simclustersann.modules
|
|
|
|
import com.google.common.util.concurrent.RateLimiter
|
|
import com.google.inject.Provides
|
|
import com.twitter.inject.TwitterModule
|
|
import com.twitter.inject.annotations.Flag
|
|
import com.twitter.simclustersann.common.FlagNames.RateLimiterQPS
|
|
import javax.inject.Singleton
|
|
|
|
object RateLimiterModule extends TwitterModule {
|
|
flag[Int](
|
|
name = RateLimiterQPS,
|
|
default = 1000,
|
|
help = "The QPS allowed by the rate limiter."
|
|
)
|
|
|
|
@Singleton
|
|
@Provides
|
|
def providesRateLimiter(
|
|
@Flag(RateLimiterQPS) rateLimiterQps: Int
|
|
): RateLimiter =
|
|
RateLimiter.create(rateLimiterQps)
|
|
}
|