Skip to content

Commit

Permalink
Modifying loop condition to find property match
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsh Gupta authored and Harsh Gupta committed May 24, 2015
1 parent 0ee5642 commit 4be3a8d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,16 @@ object RpcTimeout {

// Find the first set property or use the default value with the first property
val itr = timeoutPropList.iterator
var foundProp = (timeoutPropList.head,defaultValue)
while (itr.hasNext && (foundProp == (timeoutPropList.head,defaultValue))){
var foundProp = None: Option[(String, String)]
while (itr.hasNext && foundProp.isEmpty){
val propKey = itr.next()
conf.getOption(propKey) match {
case Some(prop) => foundProp = (propKey,prop)
case Some(prop) => foundProp = Some(propKey,prop)
case None =>
}
}
val timeout = { Utils.timeStringAsSeconds(foundProp._2) seconds }
new RpcTimeout(timeout, messagePrefix + foundProp._1)
val finalProp = foundProp.getOrElse(timeoutPropList.head, defaultValue)
val timeout = { Utils.timeStringAsSeconds(finalProp._2) seconds }
new RpcTimeout(timeout, messagePrefix + finalProp._1)
}
}

0 comments on commit 4be3a8d

Please sign in to comment.