-
-
Notifications
You must be signed in to change notification settings - Fork 318
Description
Initially to be a comment in #1908, I wanted to point out some issues with this:
Namely in regards to the data passed to rest client;
First, Timeout is a TimeSpan, which is good, and sensible.
| public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(10); |
However, the retry delay fallback is a double, and represents seconds.
DSharpPlus/DSharpPlus/Net/Rest/RestClientOptions.cs
Lines 24 to 27 in 4f42a50
| /// <summary> | |
| /// Specifies the delay to use when there was no delay information passed to the rest client. Defaults to 2.5 seconds. | |
| /// </summary> | |
| public double RatelimitRetryDelayFallback { get; set; } = 2.5; |
This would be OK if the first were also a double, and/or measured in seconds, however this timeout is an int, and measured in milliseconds.
DSharpPlus/DSharpPlus/Net/Rest/RestClientOptions.cs
Lines 29 to 32 in 4f42a50
| /// <summary> | |
| /// Specifies the amount of milliseconds we should be waiting for a ratelimit bucket hash to initialize. | |
| /// </summary> | |
| public int InitialRequestTimeout { get; set; } = 200; |
This is undoubtedly a confusing mess to deal with and relies on looking closely at documentation to not accidentally set nonsensical values in either direction for users that want to fine-tune the library.
Ideally, this would be consistent, and all three would be TimeSpan, which is an unambiguous datatype,
| public int MaximumRatelimitRetries { get; set; } = int.MaxValue; |
I also had concerns about this; it's an int, so I'd expect that -1 would be used as the sentinel value, however int.MaxValue is so absurdly huge that this doesn't really matter. That being said, perhaps this could be set to uint for that very reason.