Making WordPress.org

Changeset 8494


Ignore:
Timestamp:
03/22/2019 05:33:32 PM (5 years ago)
Author:
iandunn
Message:

Jetpack Tweaks: Lower BP API timeout to avoid exhausting PHP threads.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/jetpack-tweaks/miscellaneous.php

    r7194 r8494  
    5757}
    5858add_filter( 'contact_form_subject', __NAMESPACE__ . '\grunion_unique_subject' );
     59
     60/**
     61 * Lower the timeout for requests to the Brute Protect API to avoid unintentional DDoS.
     62 *
     63 * The default timeout is 30 seconds, but when the API goes down, the long timeouts will occupy php-fpm threads,
     64 * which will stack up until there are no more available, and the site will crash.
     65 *
     66 * @link https://wordpress.slack.com/archives/G02QCEMRY/p1553203877064600
     67 *
     68 * @param int $timeout
     69 *
     70 * @return int
     71 */
     72function lower_brute_protect_api_timeout( $timeout ) {
     73    return 8; // seconds
     74}
     75add_filter( 'jetpack_protect_connect_timeout', __NAMESPACE__ . '\lower_brute_protect_api_timeout' );
Note: See TracChangeset for help on using the changeset viewer.