api_request_as_blog( sprintf( '/sites/%d/jetpack-package-versions', $site_id ), '2', array( 'headers' => array( 'content-type' => 'application/json' ), 'method' => 'POST', ), $body, 'wpcom' ); if ( 200 === wp_remote_retrieve_response_code( $response ) ) { update_option( self::PACKAGE_VERSION_OPTION, $package_versions ); } else { set_transient( self::CACHED_FAILED_REQUEST_KEY, time(), self::CACHED_FAILED_REQUEST_EXPIRATION ); } } /** * Check if version check is being rate limited, and update the rate limiting transient if needed. * * @return bool */ private function is_rate_limiting() { if ( get_transient( static::RATE_LIMITER_KEY ) ) { return true; } set_transient( static::RATE_LIMITER_KEY, time(), static::RATE_LIMITER_TIMEOUT ); return false; } }