Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request timeout #41

Closed
codebeginer opened this issue Nov 15, 2021 · 2 comments
Closed

request timeout #41

codebeginer opened this issue Nov 15, 2021 · 2 comments

Comments

@codebeginer
Copy link

In getting segments, the request is getting timeout error. How we can increase the timeout parameter of request?
In code its set to 30 seconds. Without hard coding how can I set it?
image

@twisted1919
Copy link
Owner

You can extend the endpoint class and overwrite the method with yours, then in your overwrite, add the timeout properly:

<?php 

class MyMailWizzApi_Endpoint_ListSegments extends MailWizzApi_Endpoint_ListSegments
{
    /**
     * Get segments from a certain mail list
     *
     * Note, the results returned by this endpoint can be cached.
     *
     * @param string $listUid
     * @param integer $page
     * @param integer $perPage
     *
     * @return MailWizzApi_Http_Response
     * @throws ReflectionException
     */
    public function getSegments($listUid, $page = 1, $perPage = 10)
    {
        $client = new MailWizzApi_Http_Client(array(
            'timeout'       => 60,
            'method'        => MailWizzApi_Http_Client::METHOD_GET,
            'url'           => $this->getConfig()->getApiUrl(sprintf('lists/%s/segments', $listUid)),
            'paramsGet'     => array(
                'page'      => (int)$page,
                'per_page'  => (int)$perPage
            ),
            'enableCache'   => true,
        ));
        
        return $response = $client->request();
    }
}
<?php 
$endpoint = new MyMailWizzApi_Endpoint_ListSegments();
$endpoint->getSegments();

@codebeginer
Copy link
Author

codebeginer commented Nov 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants