Google Calendar API v3在创建频道时返回(503 backendError) [英] Google calendar API v3 returns (503 backendError) on channel creation

查看:68
本文介绍了Google Calendar API v3在创建频道时返回(503 backendError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java的Calendar API客户端库来观看频道并获得推送通知.有时,当我尝试在Google上创建频道时,它会返回以下错误响应:

I'm using Calendar API client library for Java to watch channels and get push notifications. Sometimes, when I try to create a channel on Google, it returns the following error response:

{
  "code" : 503,
  "errors" : [ {
    "domain" : "global",
    "message" : "Failed to create channel",
    "reason" : "backendError"
  } ],
  "message" : "Failed to create channel"
}

在文档中没有关于处理此错误的任何内容:

There is nothing about handling this error in the documentation:

https://developers.google.com/google-apps/calendar/v3/错误

但是,我想这可能是由于向Google发送了大量请求而导致的,并且它拒绝了连接.也许在这里,我需要一段时间后重试.问题是处理此错误并开始观看所需频道的正确方法是什么?

However, I guess it could happen due to high number of request are sent to Google and it refuses the connection. Maybe, here I need to perform retry after some time. The question is what's the correct way to handle this error and to start watching the desired channel?

推荐答案

此问题的路由原因可能是网络通信繁忙.Google Calendar API建议了指数补偿实现的解决方案.对于那种错误.

The route cause of this issue is probably a heavy network traffic. Google calendar API suggests the solution of exponential backoff implementation for that kind of errors.

指数退避是一种算法,它反复尝试执行某个操作,直到该操作成功为止,等待每次尝试之间的时间成指数增长,直至达到最大尝试次数.

An exponential backoff is an algorithm that repeatedly attempts to execute some action until that action has succeeded, waiting an amount of time that grows exponentially between each attempt, up to some maximum number of attempts.

您可以在此处找到实现想法.

You could find implementation ideas here.

这篇关于Google Calendar API v3在创建频道时返回(503 backendError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆