Code Monkey home page Code Monkey logo

Comments (5)

staviloglu avatar staviloglu commented on September 16, 2024 3

@akselarzuman selamlar.
Problemi görünce kullananlara faydası olması açısından burada issue açıp çözüm önerisini de paylaşmıştım zaten PullRequest#75 Gerçi 8 Şubattan beri bekliyor ama... :)
Sizin de kendi client'ınızı güncellemeniz çok güzel ama şahsi görüşüm iyzico kullananların ilk baktıkları yer burası olması dolayısı ile buradaki kodun güncellenmesinin daha faydalı olacağı yönünde.
Paylaşım için teşekkürler 👍 , iyi çalışmalar.

from iyzipay-dotnet.

bugrakosen avatar bugrakosen commented on September 16, 2024 3

Projeyi forklayıp bütün bu konuları gözden geçirerek yeniden yazdık. Kendi kullanımımız için yaptık fakat buraya da bırakmak istedim. Sadece .Net 5 sürümünü destekliyor. Birazcık değiştirdik :)

İstek atılırken HttpClient harici nesneler cevap aldıktan sonra using statement'ı ile dispose ediliyor. Fakat HttpClient'ı tutan nesneyi manuel dispose etmeniz gerekli. Kullanım farklılıklarından dolayı çıkacak problemleri engellemek amaçlı bu şekilde yaptım.

Gözünüze çarpan eksiklerimizi söylerseniz memnun oluruz. Umarım faydalı olur.

https://github.com/Milvasoft/Milvasoft.Iyzipay

from iyzipay-dotnet.

akselarzuman avatar akselarzuman commented on September 16, 2024 1

Merhaba,

Kendi client library'mizde bunu düzeltmiş bulunmaktayız.

https://github.com/armutcom/iyzipay-dotnet-client

from iyzipay-dotnet.

ibrahimozgon avatar ibrahimozgon commented on September 16, 2024

Biz bahsettiğiniz 2 numaralı sorunu canlıda yasıyoruz. @enerefe
System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Iyzipay.RestHttpClient.Post[T](String url, Dictionary2 headers, BaseRequest request) at Iyzipay.Model.Payment.Create(CreatePaymentRequest request, Options options) at Arabam.Core.Services.Payments.Implementations.IyzicoPaymentV2Service.PayWithOtp(OtpPaymentRequest request) ---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---
Iyzipay 2.1.33.0 versiyonu kullanıyoruz.

@akselarzuman Iyzipay yakın zamanda son bir versiyon çıkmış ancak eski yapı tamamen değişmiş gözüküyor. Bundan sonrası için Armut iyzipay projesi farklı bir yoldan ilerleyecek diyebilir miyiz?

1 numara için ise; iyzipay her request icin yeni bir httpClient üretiyor ve dispose etmiyor, armut.com ise ctor'da HttpClient üretiyor ve dispose etmiyor.
Ancak microsoft ne singleton kullanımını ne de her istekte yeni httpClient olusturmayı desteklemiyor bildiğim kadarıyla:

Therefore, HttpClient is intended to be instantiated once and reused throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. That issue will result in SocketException errors. Possible approaches to solve that problem are based on the creation of the HttpClient object as singleton or static, as explained in this Microsoft article on HttpClient usage.

But there’s a second issue with HttpClient that you can have when you use it as singleton or static object. In this case, a singleton or static HttpClient doesn’t respect DNS changes, as explained in this issue at the .NET Core GitHub repo.

To address those mentioned issues and make the management of HttpClient instances easier, .NET Core 2.1 introduced a new HttpClientFactory that can also be used to implement resilient HTTP calls by integrating Polly with it.

Kaynak: https://dotnet.microsoft.com/download/e-book/microservices-architecture/pdf

from iyzipay-dotnet.

LazZiya avatar LazZiya commented on September 16, 2024

Neredeyse 6 yıl geçmiş ama hala bir düzeltme yok ilgilenen de yok...

from iyzipay-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.