-
Notifications
You must be signed in to change notification settings - Fork 12
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
Many requests to Open Exchange Rates #6
Comments
This is a duplicate of #5 thank you |
Thank you for the quick response! I have updated from master about 3 days ago, and the issue has been resolved. Unfortunately, now the plugin doesn't make any requests to Open Exchange Rates, so it does not work. I tried removing the plugin completely and reinstalling it from the latest version released (1.4.4), and it doesn't seem to work as well. |
Urg. Would like to have some help on this - I guess this is why some people don't speak very highly of wp cron (which is not a real cron...). In the first versions of WP Currencies I was not using wp cron but a rather rough check each time you fired any of WP Currencies functions. But that was heavy. Because it did a timestamp check between the timestamp saved in db and the current time. If more than the specified interval was passed, it would pull the data from open exchange rates, update the db and then proceed with the rest of the function. As you can see, it wasn't very efficient. So I thought of moving to wp cron and let wp cron manage the updates part as a separate process, but then these issues started popping out. So, what we have now is an "update" method in Rates class: This method is called by "update_currencies" method in Cron class: "update_currencies" is also the callback of 'wp_currencies_update' wp cron action: 'wp_currencies_update' is scheduled in 2 possible occurrences:
This last method is only called when 'wp_currencies_settings' option is saved: At the moment I'm a bit lost, will try to ask around why this is not working. Do you mind checking the first link for troubleshooting? Maybe your cron is not working properly. |
I've looked around there's some possibility that object caching is interfering with DOING_CRON first of all you should check if you have this in your wp-config.php:
If you have it, delete it and try if now WP Currencies updates work. Then, if you are using some caching plugin, you could try to disable them and see if the problem still occurs. You can use Crontrol plugin to inspect Cron jobs in your installation. To verify if updates work, change update frequency and hit save on WP Currencies options, that should trigger an update. |
Ok luckily someone pointed out a possible solution which I implemented in last commit. @StewieGm can you download the last version of the plugin from Github and try it? |
Giving it a try right now. Updated via WP, set API-Key. No request as of yet (table not yet updated). Will report in some hours. |
Updated about 12 hours ago, still no requests. I see the last commit has changed, updating again now. |
try version 1.4.6 - tested locally appears to be working fine every time you save changes for an api key and new schedule, it should trigger an update however at the moment it doesn't do that if the values in the plugin options (api key, scheduled interval) are exactly the same - I might change this to force an update even when the values (api key, scheduled interval) are the same as the old ones do a test with Crontrol to check if a schedule is set and if it changes when you change setting when a schedule is set, it should run once first in any case, regardless of interval |
the latest commit on master branch clears the scheduled event and sets a new one on 'save changes' regardless if settings are changed or not |
on a last note, since 1.4.6 there is the PHP function |
I can confirm: no requests made at all with version 1.4.6 |
just tried the same with latest master. (deactivated, deleted, made sure no crons lef-over, no data in wp-currencies table). Then installed freshly, set api-key and freq to hourly. Result: no request, no cron-job installed in wp-cron. At least it seems to do "sane" requests to the api now. |
currently (as in master branch) it's working for me so I can't isolate the issue yet maybe cron is not working properly on your installation? have you tried running the function There is indeed a chance that a caching plugin or a particular host configuration might interfere with I think you should try following the steps in the troubleshooting section of the wiki: https://github.com/nekojira/wp-currencies/wiki/Troubleshooting mainly, trying to disable plugins - you can also try running WP Currencies in a local environment |
ah one last thing after your last comment, you shouldn't rely on openexchangerates.org request counter to know if a request came from your WordPress installation - there's always a delay sometimes of several minutes and you can't tell from where the request came from (even if you are confident you only have 1 installation with that api key) a more reliable way to tell is to check your wpdb with phpmyadmin or similar and check timestamps in the |
yeah i know. did check the timestamp in the table. At the moment wp-currency isn't of much use for me anyway - because I need it to get rates into WooCommerce. And there's a bug in WCML (their filters don't fire). Will be fixed in WCML 3.7. So I'm sorry I need to focus on my other projects for now. But I will report back as soon as I'm implementing the stuff with WCML. Btw: heard back from openexchangerates regarding the over-quota issue. It doesn't fit here actually, but you might be interested in that anyways:
|
to be entirely honest I had much head scratching when dealing with WPML plugins in the past. I plan to use Babble https://github.com/Automattic/babble for my future multilingual needs (it's backed by Automattic at least...). If you need WPML only for WCML in my modest opinion it's really overkilling as it would add a huge load on your installation. I think you could achieve multi-currency support in WooCommerce alternatively. As for Open Exchange Rates sounds fair enough with them - and WP Currencies fits that recommendation to design the integration to keep the requests under a limit - this too many requests issue was a regrettable accident. Technically if WP Currencies grows one could add other providers like Yahoo or Google Finance. But being a free plugin there's a limited amount of time I can spend on it. |
Yeah let's put it like it is: WPML is a bloated piece of crap. Dealing with their (obviously outsourced) support is just a pain. |
you're welcome, if you like this plugin you could star it or vote/review it on |
Since updating to version 1.4 I see the updates going from Open Exchange Rates hundreds of times daily instead of the configured setting of once per hour. Updating to 1.4.1 didn't seem to change anything with it. See my Open Exchange Rates account statistics attached here (23.06 is the date of update to 1.4, see the jump in the stats, 25.06 is the date of update to 1.4.1).
![wp-currencies bug](https://cloud.githubusercontent.com/assets/3999522/8377578/13a25e6e-1c1b-11e5-804f-b748c8ce70a7.png)
The text was updated successfully, but these errors were encountered: