Skip to content

Commit 82ee46d

Browse files
author
David McGuire
committed
Replace guard clause with nested conditional
1 parent 2794717 commit 82ee46d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

streaming/src/main/scala/org/apache/spark/streaming/receiver/RateLimiter.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ private[receiver] abstract class RateLimiter(conf: SparkConf) extends Logging {
3737
private lazy val rateLimiter = GuavaRateLimiter.create(desiredRate)
3838

3939
def waitToPush() {
40-
if( desiredRate <= 0 ) {
41-
return
40+
if( desiredRate > 0 ) {
41+
rateLimiter.acquire()
4242
}
43-
rateLimiter.acquire()
4443
}
4544
}

0 commit comments

Comments
 (0)