0

As I am aware of the limitations listed here, I need to receive some clarifications on the quota limit. I'm using the Node.js library to make a simple asynchronous speech-to-text API, using a .raw file which is stored in my bucket. After the request is done, when checking the API Manager Traffic, the daily requests counter is increased by 50 to 100 requests. I am not using any kind of requests libraries or other frameworks. Just the code from the gCloud docs.

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);
    });
})
  • How much audio is contained in the file? In terms of pricing the audio is considered as multiple chunks of 15 seconds each according to this page: https://cloud.google.com/speech/pricing. – dizcology Jul 10 '17 at 18:28

1 Answers1

0

I believe this has to do with the operation.on call, which registers a listener for the operation to complete, but continues to poll the service until it does finally finish.

I think, based on looking at some code, that you can change the interval at which the service will poll using the longrunning.initialRetryDelayMillis setting, which should reduce the number of requests you see in your quota consumption.

Some places to look:

  1. Speech client constructor: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/speech/src/index.js#L70

  2. GAX Speech Client's constructor: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/speech/src/v1/speech_client.js#L67

  3. Operations client: https://github.com/googleapis/gax-nodejs/blob/master/lib/operations_client.js#L74

  4. GAX's Operation: https://github.com/googleapis/gax-nodejs/blob/master/lib/longrunning.js#L304

JJ Geewax
  • 9,454
  • 1
  • 33
  • 47