MaxGekk commented on a change in pull request #23727: [SPARK-26817][CORE] Use 
System.nanoTime to measure time intervals
URL: https://github.com/apache/spark/pull/23727#discussion_r255143906
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/storage/BlockManager.scala
 ##########
 @@ -1340,11 +1338,14 @@ private[spark] class BlockManager(
    */
   private def getPeers(forceFetch: Boolean): Seq[BlockManagerId] = {
     peerFetchLock.synchronized {
-      val cachedPeersTtl = conf.get(config.STORAGE_CACHED_PEERS_TTL) // 
milliseconds
-      val timeout = System.currentTimeMillis - lastPeerFetchTime > 
cachedPeersTtl
+      def timeout: Boolean = {
 
 Review comment:
   Right, it's called only once but evaluated (in case of `val`) independently 
from the conditions `cachedPeers == null || forceFetch`. If we would replace 
`val` by `def`, we could eliminate unnecessary evaluation when `cachedPeers == 
null` or `forceFetch` are `true`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to