Skip to content

Commit

Permalink
Remove additional polling while installing updates
Browse files Browse the repository at this point in the history
Upon receiving a new deployment, the client starts to poll the server
every 30 seconds (Hardcoded value)
This commit removes this additional polling.

Signed-off-by: Saeed Rezaee <[email protected]>
  • Loading branch information
SaeedRe committed Jan 14, 2025
1 parent 8617dd5 commit b910cf6
Showing 1 changed file with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import org.eclipse.hara.ddiclient.api.actors.ConnectionManager.Companion.Message
import org.eclipse.hara.ddiclient.api.MessageListener
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.runBlocking
import org.joda.time.Duration

@OptIn(ObsoleteCoroutinesApi::class)
class ActionManager
Expand Down Expand Up @@ -55,17 +54,13 @@ private constructor(scope: ActorScope) : AbstractActor(scope) {
LOG.info(msg.javaClass.simpleName)
become(defaultReceive(state.copy(deployment = null)))
child("deploymentManager")!!.close()
LOG.info("Restore server ping interval")
connectionManager.send(In.SetPing(null))
}

msg is Out.DeploymentCancelInfo -> onCancelInfo(msg, state)

msg is Message.UpdateStopped -> {
LOG.info("update stopped")
become(defaultReceive(state.copy(deployment = null)))
LOG.info("Restore server ping interval")
connectionManager.send(In.SetPing(null))
}

state.inDeployment && msg is Out.NoAction -> {
Expand Down Expand Up @@ -93,8 +88,6 @@ private constructor(scope: ActorScope) : AbstractActor(scope) {
val deploymentManager = actorOf("deploymentManager") { DeploymentManager.of(it) }
become(defaultReceive(state.copy(deployment = msg)))
deploymentManager.send(msg)
LOG.info("DeploymentInfo msg, decreased ping interval to be reactive on server requests (ping: 30s)")
connectionManager.send(In.SetPing(Duration.standardSeconds(30)))
}
}
}
Expand All @@ -107,7 +100,6 @@ private constructor(scope: ActorScope) : AbstractActor(scope) {
CancelFeedbackRequest.Status.Execution.closed,
CancelFeedbackRequest.Status.Result.Finished.success)))
notificationManager.send(MessageListener.Message.State.CancellingUpdate)
connectionManager.send(In.SetPing(null))
}

!registry.currentUpdateIsCancellable() -> {
Expand All @@ -121,8 +113,6 @@ private constructor(scope: ActorScope) : AbstractActor(scope) {
else -> {
LOG.warn("DeploymentCancelInfo")
child("deploymentManager")!!.send(msg)
LOG.info("Restore server ping interval")
connectionManager.send(In.SetPing(null))
}
}
}
Expand Down

0 comments on commit b910cf6

Please sign in to comment.