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

Excessive timeout #3

Closed
rafacc87 opened this issue Oct 29, 2024 · 4 comments
Closed

Excessive timeout #3

rafacc87 opened this issue Oct 29, 2024 · 4 comments

Comments

@rafacc87
Copy link
Contributor

Why did you put 100 ms to wait for a call? Don't you think that 30 ms would be enough? It's just that if you try to add the same torrent twice instead of answering it times out and waiting 100 ms seems too much to me.

@valcriss
Copy link
Owner

To be honest, I couldn't find in the code where this timeout is defined. Could you tell me where this is located?

@rafacc87
Copy link
Contributor Author

Here's how to fix it Here's how to fix it in the PostJson function:

var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromMilliseconds(30);
var responseMessage = await httpClient.PostAsync(Url, content);

@rafacc87
Copy link
Contributor Author

rafacc87 commented Nov 3, 2024

#4 fixed

@valcriss
Copy link
Owner

valcriss commented Nov 4, 2024

Hello @rafacc87,

I have merged your MR and added an optional DelugeClientConfig parameter to let the user configure the timeout (running tests on my laptop with a dockerised deluge will fail with 3 seconds)

DelugeClientConfig config = new DelugeClientConfig()
{
    IgnoreSslErrors = true,
    Timeout = new TimeSpan(0, 0, 30)
};

DelugeClient client = new DelugeClient(url: Constants.DelugeUrl, password: Constants.DelugePassword, config);

the third parameters (config) is optional and will take the default value of 3 secondes for timeout.

let me know if it fit your need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants