应用程序引擎任务可以获取其运行次数吗?
我每小时在 Google App Engine 中运行数千个任务,其中大约 0.1% 即使在多次重试后也会失败。理想情况下,我希望他们停止尝试并退出。然而,由于应用程序引擎的设计,他们似乎只是一次又一次地尝试。我知道有一个退避时间,该时间会随着每次不成功的执行而增加,但我希望它们在 n 次重试后退出。
我可以以某种方式完成这个吗?任务可以获取其运行失败的次数吗?
I am running thousands of tasks per hour in Google App Engine and around .1% of them are failing even after multiple retries. Ideally, I want them to stop trying and exit. However, due to app engine's design they seem to be just trying again and again. I know there is a backoff time which increases with every unsuccessful execution, but I want them to exit after n retries altogether.
Can i accomplish this somehow? can a task get a count of the number of times it has unsuccessfully run?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以通过阅读 X-AppEngine-TaskRetryCount HTTP 标头。
Yes, you can get a count of the number of times your task has been retried by reading the X-AppEngine-TaskRetryCount HTTP header.