[
https://issues.apache.org/jira/browse/GEARPUMP-277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15877483#comment-15877483
]
ASF GitHub Bot commented on GEARPUMP-277:
-----------------------------------------
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/156#discussion_r102384171
--- Diff: core/src/main/scala/org/apache/gearpump/util/RestartPolicy.scala
---
@@ -26,16 +26,24 @@ import akka.actor.ChildRestartStats
* When one executor or task fails, Gearpump will try to start. However,
if it fails after
* multiple retries, then we abort.
*
- * @param maxNrOfRetries The number of times is allowed to be restarted,
negative value means no
- * limit, if the limit is exceeded the policy will
not allow to restart
+ * @param totalNrOfRetries The total number of times is allowed to be
restarted, negative value
+ * means no limit, if the limit is exceeded the
policy will not allow
+ * to restart
+ * @param maxNrOfRetriesInRange The maximum retry times in the specified
time window.
* @param withinTimeRange Duration of the time window for maxNrOfRetries.
* Duration.Inf means no window
*/
-class RestartPolicy(maxNrOfRetries: Int, withinTimeRange: Duration) {
+class RestartPolicy(totalNrOfRetries: Int, maxNrOfRetriesInRange: Int,
withinTimeRange: Duration) {
+ private var historicalRetries: Int = 0
private val status = new ChildRestartStats(null, 0, 0L)
- private val retriesWindow = (Some(maxNrOfRetries),
Some(withinTimeRange.toMillis.toInt))
+ private val retriesWindow = (Some(maxNrOfRetriesInRange),
Some(withinTimeRange.toMillis.toInt))
def allowRestart: Boolean = {
- status.requestRestartPermission(retriesWindow)
+ historicalRetries += 1
+ if (totalNrOfRetries > 0 && historicalRetries > totalNrOfRetries) {
--- End diff --
We mixed our own policy with Akka's implementation here. Can we make
it simpler ? Is restarting based on number of retries, i.e. `retriesWindow =
(Some(maxNrOfRetriesInRange), None)` good enough ?
> Allow user to configure retry times on application failure
> ----------------------------------------------------------
>
> Key: GEARPUMP-277
> URL: https://issues.apache.org/jira/browse/GEARPUMP-277
> Project: Apache Gearpump
> Issue Type: Bug
> Components: streaming
> Affects Versions: 0.8.2
> Reporter: Manu Zhang
> Assignee: Huafeng Wang
> Priority: Minor
>
> Users may want to fail fast. This would be very useful for tests.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)