PRX / speechmatics

Ruby client for Speechmatics API: https://speechmatics.com/api-details
MIT License
7 stars 15 forks source link

Update request timeout to 60 min max, response timeout to 120 seconds #4

Closed kookster closed 9 years ago

kookster commented 10 years ago

From the docs:

Uploads will timeout after 1 hour so please make sure your files are small enough to upload in a timely manner. After the data transfer finishes, it may take up to 120 seconds to generate the HTTP reply.

AndKiel commented 9 years ago

Please, fix that. I'm creating database entries with speechmatics job ids after getting response when using client.user.jobs.create(...). But I can't do that when timeout error occurs. Then it's impossible for me to update some things when speechmatics sends a callback with job id as entry with given job id does not exist in my database.

kookster commented 9 years ago

I'll get to this when I can, but to clarify, this ticket is just to update the default timeout.

You can set your own timeout value on the client in your own code (options get passed through to the underlying faraday/excon objects):

sm = Speechmatics::Client.new({ :request => { :timeout => 120 } })

As for the missing job id issue, it depends on how you do it.

For example, you can encode information in the callback url so you know how to react to an unexpected callback. For example, I know a callback to https://example.com/audio_file/123/speechmatics_callback is for the transcribe of that audio file, whether I have an entry for the job or not.

kookster commented 9 years ago

This is updated to default to 120 seconds in 0.1.2 version I just released.

kookster commented 9 years ago

actually, just kidding, try 0.1.3, that last change had a problem.

AndKiel commented 9 years ago

Thank you for a quick response. It would be nice to mention possibility of passing options to Faraday in here: https://github.com/PRX/speechmatics and here: https://www.speechmatics.com/api-details - there is nothing about that in the docs. If there was, I would have done that.

kookster commented 9 years ago

Glad that worked for you.

I added a mention to the README, feel free to PR more extensive docs if you want.

As for the speechmatics.com page, I don't work there, so you'll need to take that up with them.