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

[Q] Implementation choices #5

Open
lonix1 opened this issue Dec 12, 2024 · 0 comments
Open

[Q] Implementation choices #5

lonix1 opened this issue Dec 12, 2024 · 0 comments
Labels
question Further information is requested

Comments

@lonix1
Copy link

lonix1 commented Dec 12, 2024

  1. Why use a custom JSON parser here? The modern System.Text.Json classes are highly performant.

  2. Why instantiate an HttpClient directly? The recommended approach ([1], [2]) is to delegate that to the container, and typically resolve IHttpClientFactory. That avoids all sorts of problems like network issues and IIRC a socket exhaustion problem that was prevalent a few versions back. Amongst various benefits, it allows the consumer to

    1. create a custom client and couple that with Polly for resilience
    2. create a named/typed client so logs are more descriptive and can be filtered (else all are logged as System.Net.Http.HttpClient.Default.LogicalHandler and System.Net.Http.HttpClient.Default.ClientHandler which cannot be differentiated from other HttpClient logs)
  3. I assume one should register the service thusly: services.AddSingleton<TurnstileService>()?

BTW: these are not criticisms, just curious and/or looking for advice... Thanks!

@lonix1 lonix1 added the question Further information is requested label Dec 12, 2024
@lonix1 lonix1 changed the title [Q] Custom JSON parser vs System.Text.Json [Q] Implementation choices Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant