Documentation should show Production implemtation
After reviewing your quick start documentation I was under the assumption that there was no need for a singleton implementation to manage the connections. After testing this via a web application it was apparent that we were experiencing issues due to RestEase being unable to get an external connection.
Something like this would help explain my issues.
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IGitHubApi>((sp) =>
{
return RestClient.For<IGitHubApi>("https://api.github.com");
});
}
}
public class GitHubUserRepository
{
private readonly IGitHubApi _api;
public GitHubUserRepository(IGitHubApi api)
{
_api = api;
}
public async Task<User> Get(string id)
{
return await _api.GetUserAsync(id);
}
}
You shouldn't need a singleton instance. What issues were you seeing?
On 19 August 2017 00:32:40 BST, Skylertodd [email protected] wrote:
After reviewing your quick start documentation I was under the assumption that there was no need for a singleton implementation to manage the connections. After testing this via a web application it was apparent that we were experiencing issues due to RestEase being unable to get an external connection.
Something like this would help explain my issues.
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IGitHubApi>((sp) => { return RestClient.For<IGitHubApi>("https://api.github.com"); }); } } public class GitHubUserRepository { private readonly IGitHubApi _api; public GitHubUserRepository(IGitHubApi api) { _api = api; } public async Task<User> Get(string id) { return await _api.GetUserAsync(id); } }-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/canton7/RestEase/issues/59
When we would push this to azure, newing up the API interface in the constructor, it would start failing to connect. Somewhat random but patterned in groups. I ran a tcpview on my local as it was running in scale and it appears to me like it is grabbing sockets left and right to make outbound calls. On Sat, Aug 19, 2017 at 9:06 AM Antony Male [email protected] wrote:
You shouldn't need a singleton instance. What issues were you seeing?
On 19 August 2017 00:32:40 BST, Skylertodd [email protected] wrote:
After reviewing your quick start documentation I was under the assumption that there was no need for a singleton implementation to manage the connections. After testing this via a web application it was apparent that we were experiencing issues due to RestEase being unable to get an external connection.
Something like this would help explain my issues.
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IGitHubApi>((sp) => { return RestClient.For<IGitHubApi>("https://api.github.com"); }); } } public class GitHubUserRepository { private readonly IGitHubApi _api; public GitHubUserRepository(IGitHubApi api) { _api = api; } public async Task<User> Get(string id) { return await _api.GetUserAsync(id); } }-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/canton7/RestEase/issues/59
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canton7/RestEase/issues/59#issuecomment-323531933, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuOvkWrLx5U2-JiaUfqtDXRkHAhpcewks5sZwgHgaJpZM4O8JHZ .
Ah yeah, I think I've heard about HttpClient doing that, although I've never seen it for myself. Making the RestEase interface IDisposable and making sure it's disposed might also help. I'd add a note.
On 19 August 2017 17:26:41 BST, Skylertodd [email protected] wrote:
When we would push this to azure, newing up the API interface in the constructor, it would start failing to connect. Somewhat random but patterned in groups. I ran a tcpview on my local as it was running in scale and it appears to me like it is grabbing sockets left and right to make outbound calls. On Sat, Aug 19, 2017 at 9:06 AM Antony Male [email protected] wrote:
You shouldn't need a singleton instance. What issues were you seeing?
On 19 August 2017 00:32:40 BST, Skylertodd [email protected] wrote:
After reviewing your quick start documentation I was under the assumption that there was no need for a singleton implementation to manage the connections. After testing this via a web application it was apparent that we were experiencing issues due to RestEase being unable to get an external connection.
Something like this would help explain my issues.
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IGitHubApi>((sp) => { return RestClient.For<IGitHubApi>("https://api.github.com"); }); } } public class GitHubUserRepository { private readonly IGitHubApi _api; public GitHubUserRepository(IGitHubApi api) { _api = api; } public async Task<User> Get(string id) { return await _api.GetUserAsync(id); } }-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/canton7/RestEase/issues/59
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub
https://github.com/canton7/RestEase/issues/59#issuecomment-323531933,
or mute the thread
.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/canton7/RestEase/issues/59#issuecomment-323533055
I was attempted the Idisposable implementation, which resulted in the same behavior. In the web world, httpclient should be used in a pool or singleton configuration. I believe creating and disposing of sockets is expensive and will exhaust your available sockets at the OS level. On Sat, Aug 19, 2017 at 10:48 AM Antony Male [email protected] wrote:
Ah yeah, I think I've heard about HttpClient doing that, although I've never seen it for myself. Making the RestEase interface IDisposable and making sure it's disposed might also help. I'd add a note.
On 19 August 2017 17:26:41 BST, Skylertodd [email protected] wrote:
When we would push this to azure, newing up the API interface in the constructor, it would start failing to connect. Somewhat random but patterned in groups. I ran a tcpview on my local as it was running in scale and it appears to me like it is grabbing sockets left and right to make outbound calls. On Sat, Aug 19, 2017 at 9:06 AM Antony Male [email protected] wrote:
You shouldn't need a singleton instance. What issues were you seeing?
On 19 August 2017 00:32:40 BST, Skylertodd [email protected] wrote:
After reviewing your quick start documentation I was under the assumption that there was no need for a singleton implementation to manage the connections. After testing this via a web application it was apparent that we were experiencing issues due to RestEase being unable to get an external connection.
Something like this would help explain my issues.
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IGitHubApi>((sp) => { return RestClient.For<IGitHubApi>("https://api.github.com"); }); } } public class GitHubUserRepository { private readonly IGitHubApi _api; public GitHubUserRepository(IGitHubApi api) { _api = api; } public async Task<User> Get(string id) { return await _api.GetUserAsync(id); } }-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/canton7/RestEase/issues/59
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub
https://github.com/canton7/RestEase/issues/59#issuecomment-323531933,
or mute the thread
< https://github.com/notifications/unsubscribe-auth/AAuOvkWrLx5U2-JiaUfqtDXRkHAhpcewks5sZwgHgaJpZM4O8JHZ
.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/canton7/RestEase/issues/59#issuecomment-323533055
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canton7/RestEase/issues/59#issuecomment-323537714, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuOvt6jfxf4b-xGlxVFl6-nuY3FWaixks5sZyAHgaJpZM4O8JHZ .