Skip to content

Commit

Permalink
move signer out of retry flow, we don't need to sign every time akka#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sfali committed Aug 27, 2024
1 parent 7ac0aa4 commit 9f013cb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ object AzureStorageStream {
import system.dispatcher

val retriableFlow = Flow[HttpRequest]
.flatMapConcat(req => Signer(req, settings).signedRequest)
.mapAsync(parallelism = 1)(
req =>
singleRequest(req)
Expand All @@ -289,14 +288,15 @@ object AzureStorageStream {
import settings.retrySettings._
Source
.single(request)
.flatMapConcat(request => Signer(request, settings).signedRequest)
.via(RetryFlow.withBackoff(minBackoff, maxBackoff, randomFactor, maxRetries, retriableFlow) {
case (request, Success(response)) if isTransientError(response.status) =>
response.entity.discardBytes()
Some(request)
case (request, Failure(_)) =>
// Treat any exception as transient.
Some(request)
case _ => None
case a => None
})
.mapAsync(1)(Future.fromTry)
}
Expand Down

0 comments on commit 9f013cb

Please sign in to comment.