• I’ve discovered that when the plugin is not able to connect to Spotler mail+ (for any reason, for example the api is down, firewall blocking the request, etc), and a request never finishes, a timeout is never triggered. Instead, it will try to load forever. This can make some pages unresponsive.

    This is caused by the API client that gets created, which isn’t passed a timeout parameter. This will then use the default of the guzzle client, which is 0 (indefinitely).

    I would like to propose to add a default timeout value when creating a client, as well as adding a wordpress filter so theme developers can modify the behavior.

    The old code:

    $this->client = new Client( [
    'base_uri' => self::SPOTLER_DEFAULT_API_URL,
    'handler' => $stack,
    'auth' => 'oauth',
    ] );

    The new code (with a timeout of for example 10 seconds):

    $client_config = [
    'base_uri' => self::SPOTLER_DEFAULT_API_URL,
    'handler' => $stack,
    'auth' => 'oauth',
    'timeout' => 10,
    ];
    $client_config = apply_filters( 'mailplus_forms_client_config', $client_config );
    $this->client = new Client( $client_config );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Web Whales

    (@webwhales)

    Thanks for bringing this up and even suggesting the fix. We’ve added a 10-second timeout (and 5-second connection timeout) as default values.

    If you need to adjust these, you can use the mailplus_forms_client_timeout and mailplus_forms_client_connect_timeout filters. This fix will is included in the latest release.

    Thread Starter Menno van den Ende

    (@mennoll)

    That sounds amazing, thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.