Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7471#discussion_r35177447
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/receiver/RateLimiter.scala 
---
    @@ -34,12 +34,26 @@ import org.apache.spark.{Logging, SparkConf}
       */
     private[receiver] abstract class RateLimiter(conf: SparkConf) extends 
Logging {
     
    -  private val desiredRate = 
conf.getInt("spark.streaming.receiver.maxRate", 0)
    -  private lazy val rateLimiter = GuavaRateLimiter.create(desiredRate)
    +  // treated as an upper limit
    +  private val maxRateLimit = 
conf.getLong("spark.streaming.receiver.maxRate", Long.MaxValue)
    +  private lazy val rateLimiter = 
GuavaRateLimiter.create(maxRateLimit.toDouble)
     
       def waitToPush() {
    -    if (desiredRate > 0) {
    -      rateLimiter.acquire()
    -    }
    +    rateLimiter.acquire()
       }
    +
    +  /**
    +   * Return the current rate limit. If no limit has been set so far, it 
returns {{{Long.MaxValue}}}.
    +   */
    +  def getCurrentLimit: Long =
    +    rateLimiter.getRate.toLong
    +
    +  private[receiver] def updateRate(newRate: Long): Unit =
    --- End diff --
    
    nit: Need a scala doc, for consistency


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to