He-Pin opened a new issue, #1363:
URL: https://github.com/apache/pekko/issues/1363
Motivation:
I want to do some rate limiting and just fail the single task, eg when
combined with `mapAsync`.
Currently seems I can't observe the backpressure.
`onBackpressure` is only been called once downstream backpressure.
```scala
queue = Source.<TranslateTask>queue(10240)
.groupedWeightedWithin(
dynamicDictionaryConfigs.getMaxBatchTokens(), //最大的字符数,1000
个以内
dynamicDictionaryConfigs.getMaxBatchSize(), //最大的批量大小,50 个以内
costFn, //字符数计算
Duration.ofMillis(dynamicDictionaryConfigs.getMaxBatchIntervalInMillis()))
//最大的聚合时间,比如 3ms
.onBackpressure(task -> task.fail(...)) //
.buffer(dynamicDictionaryConfigs.getOvsQpsLimit() * 2,
OverflowStrategy.backpressure())
.toMat(Sink.foreach(this::batchTranslate), Keep.left())
....
.run(actorSystem);
```
What do you think?
--
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]