【问题标题】:Speech-Api daily requests quota counter increses too much after one requestSpeech-Api 每日请求配额计数器在一个请求后增加太多
【发布时间】:2016-11-01 09:20:07
【问题描述】:

由于我知道here 列出的限制,我需要对配额限制进行一些说明。 我正在使用 Node.js 库制作一个简单的异步语音到文本 API,使用存储在我的存储桶中的 .raw 文件。 请求完成后,当检查API Manager Traffic 时,每日请求计数器增加 50 到 100 个请求。 我没有使用任何类型的请求库或其他框架。只是 gCloud 文档中的代码。

var file = URL.bucket +  "audio.raw"; //require from upload.
speech.startRecognition(file, config).then((data) => {
    var operation = data[0];

    operation.on('complete', function(transcript) {
        console.log(transcript);
    });
})

【问题讨论】:

标签: google-cloud-platform gcloud-node google-cloud-speech


【解决方案1】:

我相信这与 operation.on 调用有关,它注册了一个侦听器以完成操作,但会继续轮询服务直到它最终完成。

我认为,基于查看一些代码,您可以使用 longrunning.initialRetryDelayMillis 设置更改服务轮询的时间间隔,这应该会减少您在您的配额消耗。

一些值得一看的地方:

  1. 语音客户端构造函数:https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/speech/src/index.js#L70

  2. GAX Speech Client 的构造函数:https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/speech/src/v1/speech_client.js#L67

  3. 运维客户端:https://github.com/googleapis/gax-nodejs/blob/master/lib/operations_client.js#L74

  4. GAX 运营:https://github.com/googleapis/gax-nodejs/blob/master/lib/longrunning.js#L304

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-21
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多