简体   繁体   English

GCP Pub/Sub 重试次数超过配置

[英]GCP Pub/Sub does more retries than configured

I have a Pub/Sub push subscription that is triggering Cloud Function. There is retry policy with expotential backoff and dead lettering enabled.我有一个触发 Cloud Function 的 Pub/Sub 推送订阅。有启用指数退避和死信的重试策略。

Configuration is next:接下来是配置:

  • Acknowledge deadline is 60s确认截止时间为 60 秒
  • Exactly once delivery enabled Exactly once delivery 启用
  • Maximum delivery attempts is 5最大投递尝试次数为 5
  • Miniumn backoff - 30s, maximum backoff - 600s最小退避 - 30 秒,最大退避 - 600 秒

For testing purposes I configured Cloud Function to always return 500 error code.出于测试目的,我将 Cloud Function 配置为始终返回 500 错误代码。 But instead of 5 retries and 1 event in dead letter topic there was:但是在死信主题中不是 5 次重试和 1 次事件而是:

  • 6 retries and 2 events in dead letter topic死信主题中的 6 次重试和 2 次事件
  • 7 retries and 3 events in dead letter topic死信主题中的 7 次重试和 3 次事件
  • 10 retries and 6 events in dead letter topic死信主题中的 10 次重试和 6 次事件

I can assume that dead letter topic received more events because there was more retries than expected.我可以假设死信主题收到了更多事件,因为重试次数比预期的多。 But I cannot understand why there was more retries than configured?但是我不明白为什么重试次数比配置的多?

Pub/Sub has a built in At-least-once delivery system which will retry messages that were not acknowledged. Pub/Sub 有一个内置的至少一次传递系统,该系统将重试未确认的消息。 In this case, after 600s have passed, the message you first sent becomes unacknowledged, thus Pub/Sub retries the message.在这种情况下,在 600 秒过去后,您第一次发送的消息变得未被确认,因此 Pub/Sub 会重试该消息。 It will keep retrying it for 600s until it reaches the messageRetentionDuration or you acknowledge it.它将继续重试 600 秒,直到达到 messageRetentionDuration 或您确认为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM