mdedetrich commented on code in PR #549:
URL: https://github.com/apache/incubator-pekko/pull/549#discussion_r1286869433


##########
multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala:
##########
@@ -338,21 +340,36 @@ private[pekko] class PlayerHandler(
 
   import ClientFSM._
 
-  val connectionRef: AtomicReference[RemoteConnection] = new 
AtomicReference[RemoteConnection](reconnect())
+  val connectionRef: AtomicReference[RemoteConnection] = new 
AtomicReference[RemoteConnection]()
 
   var nextAttempt: Deadline = _
 
+  tryConnectToController()
+
   @nowarn("msg=deprecated")
   override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): 
Unit = {
     log.error("channel {} exception {}", ctx.channel(), cause)
     cause match {
       case _: ConnectException if reconnects > 0 =>
         reconnects -= 1
-        
scheduler.scheduleOnce(nextAttempt.timeLeft)(connectionRef.set(reconnect()))
       case e => fsm ! ConnectionFailure(e.getMessage)
     }
   }
 
+  private def tryConnectToController(): Unit = {
+    Try(reconnect()) match {
+      case Success(r) => connectionRef.set(r)
+      case Failure(ex) =>

Review Comment:
   Is it worth it to use exponential backoff here or is that excessive?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to