Skip to content

Commit

Permalink
Merge pull request #141 from commercetools/gcp-pub-sub-max-ack-deadline
Browse files Browse the repository at this point in the history
Fix maxAckDeadline in GCP pub/sub puller
  • Loading branch information
AL333Z authored Jan 10, 2025
2 parents 1905cb2 + 443344f commit e10e1d7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ private class PubSubPuller[F[_], T](
deserializer: Deserializer[T])
extends UnsealedQueuePuller[F, T] {

private val maxAckDeadlineSeconds = 600

private def callContext(waitingTime: FiniteDuration): ApiCallContext =
GrpcCallContext
.createDefault()
Expand Down Expand Up @@ -87,7 +89,8 @@ private class PubSubPuller[F[_], T](
.newBuilder()
.addAckIds(msg.getAckId())
.setSubscription(subscriptionName.toString())
.setAckDeadlineSeconds(time.Duration.between(now, until).getSeconds().toInt)
.setAckDeadlineSeconds(
Math.min(time.Duration.between(now, until).getSeconds().toInt, maxAckDeadlineSeconds))
.build()))).as(None)
case _ => F.pure(Some(msg))
}
Expand Down

0 comments on commit e10e1d7

Please sign in to comment.