This is an automated email from the ASF dual-hosted git repository.
tysonnorris pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 7ff1550 Use Stricter Retry Logic in AkkaContainerClient (#4223)
7ff1550 is described below
commit 7ff15502949fa21ab5621825204397ad9eb6dfe5
Author: James Dubee <[email protected]>
AuthorDate: Wed Jan 23 15:30:03 2019 -0500
Use Stricter Retry Logic in AkkaContainerClient (#4223)
---
.../openwhisk/core/containerpool/AkkaContainerClient.scala | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git
a/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/AkkaContainerClient.scala
b/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/AkkaContainerClient.scala
index e32ca77..8eaab12 100644
---
a/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/AkkaContainerClient.scala
+++
b/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/AkkaContainerClient.scala
@@ -49,6 +49,7 @@ import org.apache.openwhisk.core.entity.ActivationResponse._
import org.apache.openwhisk.core.entity.ByteSize
import org.apache.openwhisk.core.entity.size.SizeLong
import org.apache.openwhisk.http.PoolingRestClient
+import java.time.Instant
/**
* This HTTP client is used only in the invoker to communicate with the action
container.
@@ -135,13 +136,17 @@ protected class AkkaContainerClient(
timeout: FiniteDuration,
retry: Boolean,
retryCount: Int = 0): Future[(HttpResponse,
Int)] = {
+ val start = Instant.now
+
request(req)
.map((_, retryCount))
.recoverWith {
case t: StreamTcpException if retry =>
- val newTimeout = timeout - retryInterval
- if (newTimeout > Duration.Zero) {
- akka.pattern.after(retryInterval,
as.scheduler)(retryingRequest(req, newTimeout, retry, retryCount + 1))
+ if (timeout > Duration.Zero) {
+ akka.pattern.after(retryInterval, as.scheduler)({
+ val newTimeout = timeout - (Instant.now.toEpochMilli -
start.toEpochMilli).milliseconds
+ retryingRequest(req, newTimeout, retry, retryCount + 1)
+ })
} else {
logging.warn(
this,