Skip to content

How to change Client GRPC deadline? #283

Description

@bloodcarter

I randomly receive this error while streaming data:
Client GRPC deadline too short. Should be at least: 3 * audio-duration + 5 seconds. Current deadline is: 59.699356980447192 second(s). Required at least: 60 second(s).

What should I do with that?

Activity

  1. jmdobry commented on Dec 22, 2016

    @jmdobry
    Member

    @jmuk How would one increase the deadline?

  2. jmuk commented on Dec 27, 2016

    @jmuk

    The autogen layer can customize the deadline through the CallOption parameter, however @google-cloud/speech hand-written layer doesn't allow passing timeout by themselves.

    Which method are you using? I'm wild-guessing that asyncRecognize does not have such restriction.

  3. jmdobry commented on Feb 8, 2017

    @jmdobry
    Member

    Something like this would work:

    const v1beta1 = require('@google-cloud/speech').v1beta1();
    const speech = v1beta1.speechClient();
    
    const request = {
      audio: {
        uri: 'gs://my-bucket/filename.raw'
      },
      config: {
        encoding: 'LINEAR16',
        sampleRate: 16000
      }
    };
    
    const options = {
      longrunning: {
        initialRetryDelayMillis: 100, , // Default
        retryDelayMultiplier: 1.3, // Default
        maxRetryDelayMillis: 60000, // Default
        initialRpcTimeoutMillis: null, // Default
        rpcTimeoutMultiplier: null, // Default
        maxRpcTimeoutMillis: null, // Default
        totalTimeoutMillis: 600000 // Default
      }
    };
    
    speech.syncRecognize(request, options)
      .then((results) => {
        const transcription = results[0];
    
        console.log(transcription);
      });
  4. bloodcarter commented on Feb 9, 2017

    @bloodcarter
    Author

    @jmdobry Would this work with recognizeStream?

  5. jmdobry commented on Feb 9, 2017

    @jmdobry
    Member

    I'm not sure the bi-directional streaming uses exponential backoff. @jmuk?

  6. jmuk commented on Feb 9, 2017

    @jmuk

    @bloodcarter: createRecognizeStream can customize the timeout as https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/speech/src/index.js#L378

    const speech = require('@google-cloud')();
    const stream = speech.createRecognizeStream(..., {timeout: 300});
    ...

    @jmdobry: bidi streaming does not use exponential backoff, but uses timeout field in the options.

    const v1beta1 = require('@google-cloud/speech').v1beta1();
    const speech = v1beta1.speechClient();
    
    // set the timeout to 300 seconds.
    const stream = speech.streamingRecognize({timeout: 300});
    stream.write(...);
    ...

    This should customize the timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions