| @@ -129,9 +129,20 @@ | ||
| 129 | 129 | 'body' => $body, |
| 130 | 130 | 'cookies' => [], |
| 131 | 131 | ]; |
| 132 | 132 | |
| 133 | - // @TODO: Switch to Logtivity_Response class to get standardized responses | |
| 133 | + /** | |
| 134 | + * This request must not be cached. It writes a log entry to the API rather | |
| 135 | + * than reading a cacheable resource, so a cached response would silently | |
| 136 | + * drop logs. The default path is also non-blocking with a 0.01s timeout, | |
| 137 | + * so it does not hold up the page load. | |
| 138 | + * | |
| 139 | + * Settings check-ins are already rate limited by | |
| 140 | + * Logtivity_Options::shouldCheckInWithApi(), which gates on the | |
| 141 | + * logtivity_last_settings_check_in_at option. | |
| 142 | + * | |
| 143 | + * @TODO: Switch to Logtivity_Response class to get standardized responses | |
| 144 | + */ | |
| 134 | 145 | $response = wp_remote_request($this->getEndpoint($url), $request); |
| 135 | 146 | if ($waitForResponse && $this->notUpdatingWidgetInCustomizer()) { |
| 136 | 147 | // We waited and received a response |
| 137 | 148 | if ($response instanceof WP_Error) { |
| @@ -203,9 +214,10 @@ | ||
| 203 | 214 | * @return bool |
| 204 | 215 | */ |
| 205 | 216 | protected function ready(): bool |
| 206 | 217 | { |
| 207 | - return ($this->getApiKey()) | |
| 218 | + return logtivity_url_environment_mismatch() == false | |
| 219 | + && ($this->getApiKey()) | |
| 208 | 220 | && logtivity_has_site_url_changed() == false |
| 209 | 221 | && ( |
| 210 | 222 | $this->ignoreStatus |
| 211 | 223 | || $this->getOption('logtivity_api_key_check') == 'success' |