Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Allow both/or configuring a shorter Twilio-side global timeout or shorter timeout for POST requests #519

Open
bf4 opened this issue Jul 9, 2020 · 1 comment
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap

Comments

@bf4
Copy link

bf4 commented Jul 9, 2020

Issue Summary

  1. Twilio usually responds within a second
  2. We need requests to be quick because e.g. for phone number lookup we have to complete the request within 30 seconds due to Heroku router constraints
  3. We set the http client time out to 10 seconds which seems reasonable
  4. When we get an execution expired due to http client timeout on message send, it's possible that Twilio eventually processed the request.
  5. We don't want to send the message twice.
  6. It would be best if Twilio closed the connection with an error code https://www.twilio.com/docs/api/errors/20500 rather than for the http client to timeout and then we'd have to wait some amount of time to try to see if the message exists in in the logs
  7. Right now we need to wait maybe 26 seconds for Twilio to timeout which means we can only use the 10 second timeout if we're sure we're not making transactional requests, as per the docs: "POST requests - sending an SMS or triggering an outbound call - are not idempotent. If you get a 500 Server Error on these requests, and you retry the request, it is possible for a customer to receive multiple messages or calls from your application."

Proposal

Therefore, I'd like to request that Twilio internally to have the 26 second timeout reviewed, and possibly grant a global option within the Twilio client to reduce this timeout for an account

Regular API requests, like phone number validation, 10 seconds is fine. There's a huge unknown period of time between 10 and 30 (15 and 25 seconds) where Twilio may or may not complete a transactional request and we'd be in better shape if Twilio made that decision.

I think that having a timeout and transactional_timeout with sane defaults built in by Librarian would go a good way, even if they're opt-in.

Steps to Reproduce

  1. Make a POST request
  2. Did the execution expire?
  3. Make this issue

Code Snippet

twilio_client.messages.create(payload.symbolize_keys)

Exception/Log

Twilio::REST::TwilioError execution expired

Technical details:

  • twilio-ruby version: 5.38.0
  • ruby version: 2.6.2
  • environment: Heroku

Related to twilio support ticket 4562575 as suggested by Noel Gaffney

@thinkingserious
Copy link
Contributor

Additional context: #493

@thinkingserious thinkingserious added status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap labels Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

2 participants