Skip to content

Commit 4be3a8d

Browse files
Harsh GuptaHarsh Gupta
Harsh Gupta
authored and
Harsh Gupta
committed
Modifying loop condition to find property match
1 parent 0ee5642 commit 4be3a8d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,16 @@ object RpcTimeout {
265265

266266
// Find the first set property or use the default value with the first property
267267
val itr = timeoutPropList.iterator
268-
var foundProp = (timeoutPropList.head,defaultValue)
269-
while (itr.hasNext && (foundProp == (timeoutPropList.head,defaultValue))){
268+
var foundProp = None: Option[(String, String)]
269+
while (itr.hasNext && foundProp.isEmpty){
270270
val propKey = itr.next()
271271
conf.getOption(propKey) match {
272-
case Some(prop) => foundProp = (propKey,prop)
272+
case Some(prop) => foundProp = Some(propKey,prop)
273273
case None =>
274274
}
275275
}
276-
val timeout = { Utils.timeStringAsSeconds(foundProp._2) seconds }
277-
new RpcTimeout(timeout, messagePrefix + foundProp._1)
276+
val finalProp = foundProp.getOrElse(timeoutPropList.head, defaultValue)
277+
val timeout = { Utils.timeStringAsSeconds(finalProp._2) seconds }
278+
new RpcTimeout(timeout, messagePrefix + finalProp._1)
278279
}
279280
}

0 commit comments

Comments
 (0)