Skip to content

Commit

Permalink
fix: Discover and health check with service incarnation (#1853)
Browse files Browse the repository at this point in the history
* fix: Discover and health check with service incarnation

* kalix-proxy protocol 1.1.23
  • Loading branch information
patriknw authored Nov 15, 2023
1 parent f0e0b7d commit eaaee32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Dependencies {
object Kalix {
val ProtocolVersionMajor = 1
val ProtocolVersionMinor = 1
val ProxyVersion = System.getProperty("kalix-proxy.version", "1.1.22")
val ProxyVersion = System.getProperty("kalix-proxy.version", "1.1.23")
}

// changing the Scala version of the Java SDK affects end users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package kalix.javasdk.impl

import java.time.Duration
import java.util
import java.util.UUID
import java.util.concurrent.atomic.AtomicReference

import scala.concurrent.Future
Expand Down Expand Up @@ -52,6 +53,8 @@ class DiscoveryImpl(

private val log = LoggerFactory.getLogger(getClass)

private val serviceIncarnationUuid = UUID.randomUUID().toString

// Delay CoordinatedShutdown until the proxy has been terminated.
// This is updated from the `discover` call with a new Promise. Completed in the `proxyTerminated` call.
private val proxyTerminatedRef = new AtomicReference[Promise[Done]](Promise.successful(Done))
Expand Down Expand Up @@ -107,7 +110,8 @@ class DiscoveryImpl(
protocolMinorVersion =
configuredIntOrElse("kalix.library.protocol-minor-version", BuildInfo.protocolMinorVersion),
// passed along for substitution in options
env = env)
env = env,
serviceIncarnationUuid = serviceIncarnationUuid)

if (isVersionProbe(in)) {
// only (silently) send service info for hybrid proxy version probe
Expand Down Expand Up @@ -207,8 +211,8 @@ class DiscoveryImpl(
Future.successful(com.google.protobuf.empty.Empty.defaultInstance)
}

override def healthCheck(in: Empty): Future[Empty] =
Future.successful(Empty.defaultInstance)
override def healthCheck(in: Empty): Future[HealthCheckResponse] =
Future.successful(HealthCheckResponse(serviceIncarnationUuid))

private def loadSource(location: UserFunctionError.SourceLocation): Option[String] =
if (location.endLine == 0 && location.endCol == 0) {
Expand Down

0 comments on commit eaaee32

Please sign in to comment.