braintree / braintree_dotnet

Braintree .NET library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
136 stars 73 forks source link

[IMPORTANT] Automatic Retries / Timeout Configuration #61

Closed iamcarbon closed 7 years ago

iamcarbon commented 7 years ago

General information

Issue description

Over the past few days, we have been receiving a lot of connection timeout errors (50+). Can the library automatically retry if a connection can't be established in a reasonable time period (i.e. 30 seconds) -- it's currently using the .NET default of 60 seconds, or allow the timeout to be configured so retry function can be added up the stack.

Stack Trace:

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 204.109.13.121:443 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at Braintree.BraintreeService.GetXmlResponse(String URL, String method, Request requestBody) at Braintree.BraintreeService.Post(String URL, Request requestBody) at Braintree.TransactionGateway.Sale(TransactionRequest request)

bluk commented 7 years ago

Please contact Braintree Support to help investigate the connection timeout errors you are experiencing. I'm not sure that increasing the connection timeout would help, so best to discuss with Braintree Support.

We will consider adding connection retries, but for now, you may have to add your own connection retry logic. If you want to submit a PR, we can definitely take a look.

lkorth commented 7 years ago

Closing this stale issue.

@iamcarbon if you are still experiencing problems, please comment or contact Braintree Support and we will followup.