He-Pin opened a new issue, #3220:
URL: https://github.com/apache/pekko/issues/3220
### Motivation
`Flow.recoverWithRetries` 仅接受重试次数和恢复
PartialFunction,没有退避(backoff)或延迟参数。每次重试立即执行,在恢复源也是故障源时会导致快速连续失败,浪费资源。
### 当前代码行为
`Flow.scala` 中的签名:
```scala
// Flow.scala:950-953
def recoverWithRetries(
attempts: Int,
pf: PartialFunction[Throwable, Graph[SourceShape[Out], NotUsed]]
): Repr[Out]
```
实现(`Ops.scala:2286-2348`)中仅有 `maximumRetries` 计数,无 delay/backoff
参数。失败后立即切换到恢复 Source。
### 预期行为
提供带退避参数的重载版本,例如:
```scala
def recoverWithRetries(
attempts: Int,
minBackoff: FiniteDuration,
maxBackoff: FiniteDuration,
randomFactor: Double,
pf: PartialFunction[Throwable, Graph[SourceShape[Out], NotUsed]]
): Repr[Out]
```
### 代码证据
-
`stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala:950-953` —
当前签名
-
`stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala:2286-2348`
— 实现,仅有 `maximumRetries`
### 复现方式
当恢复 Source 本身需要时间初始化(如网络连接)时,立即重试会导致快速连续失败。
### 影响范围
- 模块:`pekko-stream`
- 影响使用 `recoverWithRetries` 进行故障恢复的流
- 在恢复源依赖外部资源时,无退避重试可能加剧故障
--
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]