Advaith3600 / PowerToys-Run-Currency-Converter

PowerToys Run plugin which will convert real and crypto currencies.
MIT License
161 stars 8 forks source link

feat: Use Cloudflare Pages instead of JSDelivr #14

Closed GeekCornerGH closed 4 months ago

GeekCornerGH commented 4 months ago

JSDelivr caches data for 12 hours, which impact data accuracy.

Per this issue comment, using the Cloudflare Pages endpoint is the way to go

Advaith3600 commented 4 months ago

Hello, Thank you for your interest in this plugin and for the PR you’ve submitted. I believe it may not be the best course of action to switch from JSDelivr to Cloudflare. Here are my reasons:

  1. JSDelivr provides a cached response of the generated conversion list, as opposed to a real-time calculation. This ensures that the endpoint is consistently available and can support a large number of requests without failure.
  2. The Cloudflare endpoint is not cached and likely has a server limit on traffic, given that they are using pages. The documentation of the API says to use the Cloudflare endpoint as a fallback mechanism.

image

The image above demonstrates that Cloudflare does not perform any caching.

Furthermore, it’s important to note that the primary purpose of this plugin is to provide quick conversions based on the market estimate for the day. I hope this clarifies my perspective. I’m open to further discussion and appreciate your contributions to improving this plugin.

GeekCornerGH commented 4 months ago

Hi, you may check the comment I linked, where the author explained the caching issue

Advaith3600 commented 4 months ago

I saw the comment, and that is not an issue. Caching is a mechanism we deliberately implement and rely on. Without it, the server won't be able to handle huge traffic and the reliability won't be there. Unless there is a better alternative than moving to a web server with no caching to solve the issue of minor differences in currency values over a short period, we will be sticking with the cached endpoint itself.

It might be an issue for some people who need the conversion rate to be perfect all the time, at least in our case where we don't control the infrastructure for the server, it is not a wise decision to move to a less reliable endpoint. A 12-hour gap between currency rate changes is not a big deal personally

GeekCornerGH commented 4 months ago

Fair enough