SteamRE / SteamKit

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
GNU Lesser General Public License v2.1
2.63k stars 497 forks source link

WebAPI DefaultTimeout is not set to a reasonable default #993

Open azuisleet opened 3 years ago

azuisleet commented 3 years ago

The default timeout for WebAPI requests is set to a fixed 100 seconds currently, and there's no simple way to reconfigure it for classes like SteamDirectory that use the SteamConfigurationWebAPIExtensions to generate WebAPI interfaces from the SteamConfiguration.

https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Steam/WebAPI/WebAPI.cs https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Steam/WebAPI/SteamConfigurationWebAPIExtensions.cs

There should probably be:

  1. A reasonable default closer to ConnectionTimeout (understanding that for HTTP requests, this is a full round trip timeout)
  2. The option to configure the timeout
yaakov-h commented 3 years ago
azuisleet commented 3 years ago
  1. If the user can configure all the other timeouts, including ConnectionTimeout and CDNClient timeouts, they should also be able to configure the timeouts that affect all WebAPI based requests.
  2. A reasonable timeout is probably closer to 30 seconds for a full request and response.
  3. I want to lower the timeout used to fetch the server list in SteamDirectory, as ConnectionTimeout is set to 5 seconds while the lookup is set to 100 seconds, as this affects how long CMClient.Connect takes (105 seconds in this case)
  4. Being able to set WebAPI.DefaultTimeout would be sufficient.

Also to be clear, if you own a WebAPI instance, there is a configurable Timeout property. https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Steam/WebAPI/WebAPI.cs#L47

In this case, SteamDirectory owns the WebAPI instance https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Steam/WebAPI/SteamDirectory.cs#L50

yaakov-h commented 3 years ago

SteamDirectory owns it, and has a SteamConfiguration instance, so I'm tempted to add SteamConfiguration.WebApiTimeout so that it's not just some big static that people have to mutate.

Any thoughts on that?

xPaw commented 1 year ago

SteamConfiguration.WebApiTimeout sounds good because you can get instances of WebAPI from Configuration.