PurpleTurtleCreative / completionist

Asana integration plugin for WordPress.
https://purpleturtlecreative.com/completionist/
GNU General Public License v3.0
1 stars 0 forks source link

use wp_remote_get instead of PHP curl to proxy Asana attachment requests #152

Closed MichelleBlanchette closed 1 year ago

MichelleBlanchette commented 1 year ago

Took a few benchmarks for loading the proxied image. See table below of recorded loading times in seconds.

The benchmarks felt pretty inconsistent (probably since we're depending on a third-party server with variable traffic/resources). However, if anything, wp_remote_get() happened to have a lower average, median, and standard deviation. Could very well be random, though.

Screenshot 2023-07-07 at 11 53 31 AM
MichelleBlanchette commented 1 year ago

The best part is that the code is more readable, uses the WordPress event system for third-party customization and intervention, and is 19 fewer lines. 👍

MichelleBlanchette commented 1 year ago

Oh, I just realized I could use server-side caching for this, too... 🤔

MichelleBlanchette commented 1 year ago

So I was working on caching the proxied response and making a different endpoint... Development was fine, but I really just don't feel good about doing my own server-side caching in the Request Token because I wouldn't actually respect the Cache-Control max-age time. Also, it's completely unnecessary when the user's web browser should already be properly handling the caching. So I will actually forego the caching part of issue #139 and simply leave it at the updated cURL process.