NOTE
One of LearnDash’s support reps posted a long response to this issue in the LearnDash Facebook group. It’s a bit more technical than this article, but it’s worth reading, and has some important caveats before you use this code snippet. And he knows a lot more about exactly what it’s doing and how it works than I do. I’ve included it at the end of this article.
If you’re evaluating the performance of your LearnDash site, you might notice a common warning often found in the Query Monitor plugin under “HTTP API Calls.” It looks something like this:
It’s a GET request, with the following parameters:
URL
https://bitbucket.org/learndash/learndash-add-ons/get/stable.zip?...
STATUS
429 Too Many Requests
CALLER
LearnDash_BitBucket_API->get_bitbucket_repositories()
wp-content/plugins/sfwd-lms/includes/class-ld-bitbucket-api.php:249
LearnDash_Addon_Updater->get_addon_plugins()
wp-content/plugins/sfwd-lms/includes/class-ld-addons-updater.php:565
nss_plugin_updater_sfwd_lms->get_plugin_readme()
wp-content/plugins/sfwd-lms/includes/ld-autoupdate.php:392
nss_plugin_updater_sfwd_lms->get_plugin_upgrade_notice()
wp-content/plugins/sfwd-lms/includes/ld-autoupdate.php:400
nss_plugin_updater_sfwd_lms->admin_notice_upgrade_notice()
wp-content/plugins/sfwd-lms/includes/ld-autoupdate.php:255
do_action('admin_notices')
wp-includes/plugin.php:470
Some of your line numbers might be different, but it will start with LearnDash_BitBucket_API->get_bitbucket_repositories()
.
COMPONENT
Plugin: sfwd-lms
What is it?
The LearnDash plugin includes some code that allows it to check its own servers for updates. This is how it presents updates to you on your Plugins page in the WordPress admin area. And when you update to a newer version, your website asks LearnDash’s server for the new files, and LearnDash’s server responds with the files.
However, I believe that code is checking LearnDash’s servers pretty frequently for updates, and this warning is telling you it’s happening quite frequently.
What is Bitbucket?
Bitbucket is a third-party solution for managing & hosting software code. LearnDash uses Bitbucket as a way to manage the changes in its code over time, as well as to deliver new updates to the plugin to its users.
How to block Bitbucket API calls from LearnDash?
WARNING
Blocking Bitbucket API calls will mean you need to manually check for updates to LearnDash & its add-ons.
The frequency of these calls might be putting excess strain on your web server, although according to LearnDash, this has no affect on your site’s performance. If you’d like to stop this from happening, you can add the following code to your wp-config.php
file, just before the line that says:
/* That's all, stop editing! Happy blogging. */
WARNING
Be very careful editing the wp-config.php
file. One small mistake can bring your entire website down.
For LearnDash 3.1.8 & Above
if ( ! defined( 'LEARNDASH_UPDATES_ENABLED' ) ) {
define( 'LEARNDASH_UPDATES_ENABLED', false );
}
For LearnDash 3.1.7 & Below
if ( ! defined( 'LEARNDASH_ADDONS_UPDATER' ) ) {
define( 'LEARNDASH_ADDONS_UPDATER', false );}
if ( ! class_exists( 'LearnDash_Addon_Updater' ) ) {
class LearnDash_Addon_Updater {
protected static $instance = null;
public static function get_instance() {
if ( ! isset( static::$instance ) ) {
static::$instance = new static();
}
return static::$instance;
}
public function __call( $name, $arguments ) {
return;
}
}
}
Original Source: developers.learndash.com
LearnDash Support’s Response
A member of LearnDash’s support team had this to say in response to a user who was experiencing this in Query Monitor:
“The slowness issues experienced by [user] on the linked topic was an issue with his hosting server trying to connect to our BitBucket repository over IPv6. He had to eventually have his hosting provider sort it out on their end and it required rebooting a router at the host as the outbound traffic from the hosting server to the BitBucket repository over IPv6 was failing.
Going back to the initial question… these failed requests can be ignored. It just signals that our add-on repository “bucket” has denied the request from your site to check for an update to our add-ons. These checks happen multiple times every hour and the bucket we host the add-ons at has a limit per hour on the amount of requests that can be made. Additionally, this warning is only shown in Query Monitor and doesn’t affect the performance of a site from what we have found.
If you go to LearnDash LMS > Addons in the WP admin area and see that warning in Query Monitor, click on the Check Updates button at the top right of the list of add-ons. Once the refresh happens, you may see that Query Monitor no longer shows that warning for the “429 too many requests” failure. This is because for that particular request, the bucket allowed a request from your site to check for any updates from our add-ons. If you check for updates again, the next request may fail or the next 5 checks may succeed or a combination of both.
Having these failed requests really doesn’t cause any issues other than maybe not seeing that one of our add-ons has an update available for 30 minutes to an hour. Eventually though, one of these requests will go through within a short period of time and you’ll be notified of any available updates to our add-ons, if you are using them.
You can disable the check by adding this code to your wp-config.php
file:
define( 'LEARNDASH_ADDONS_UPDATER', false );
But you will then have to manually check for any updates to the add-ons you are using and install those manually.”