kdcllc / CometD.NetCore

CometD for use with Salesforce Platform Events
MIT License
28 stars 16 forks source link

Honor the timeout advice given by the server #13

Closed jesbacon closed 3 years ago

jesbacon commented 4 years ago

I'm having the exact same error as was presented in #3 .

I have tracked the problem to be that the Salesforce server indicates that we need to connect again within 110 seconds; this is from the advice field provided and can be seen in the logs provided in the above issue. When we send our long polling message there is a watchdog set to fire in 120 seconds. What isn't done however is to set the timeout for the actual HTTP request. In .Net core, that timeout is 100 seconds by default. Hence it occurs before any of these other events. We get the exception observed.

In the resolution to #3 there was a timeout value plumbed partially in; I don't see where it is ever actually specified to be other than the default 120 seconds, and it doesn't appear to be reachable to anyone using this package. (Nor should it be, this is an internal implementation detail.)

I looked through the CometD JavaScript implementation and it uses the advice values returned by the server plus a configurable network jitter value (maxNetworkDelay) to intelligently set the timeout of the HTTP request.

Is there a plan or appetite for this functionality?

kdcllc commented 4 years ago

@jesbacon would you be interested in PR for this?

jesbacon commented 4 years ago

I would; it's not my highest priority at the moment. I'll put something together once I've cleared my current workload.

kdcllc commented 3 years ago

@jesbacon thanks for your contribution.