deployphp / deployer

The PHP deployment tool with support for popular frameworks out of the box
https://deployer.org
MIT License
10.42k stars 1.47k forks source link

Sentry recipe : increase Httpie timeout #3160

Open franck-grenier opened 2 years ago

franck-grenier commented 2 years ago

Hello Deployer, I'm having troubles to POST my releases and their deploys to my self-hosted Sentry.

Randomly, POST requests are ended on client-side by Httpie timeout of 5s (https://github.com/deployphp/deployer/blob/master/src/Utility/Httpie.php#L153). I can see them arrive on my Sentry server responding 499.

Do you know how i can increase these Curl timeout params for the Sentry recipe ?

Thanks

Upvote & Fund

Fund with Polar

norkunas commented 1 year ago

having same problem..

franck-grenier commented 1 year ago

What I did to avoid deployment failures due to timeouts : catch the exception

task('deploy:sentry:once', function(){
    try {
        invoke('deploy:sentry');
    } catch (\Exception $e) {
        info('Unable to push release or deploy to Sentry : ' . $e->getMessage());
    }
})->once();
antonmedv commented 1 year ago

Clever)

jackd248 commented 1 year ago

Hej, I'm having the same problem and wanted to ask, if there will be an option to increase the curl timeout? https://github.com/deployphp/deployer/blob/master/src/Utility/Httpie.php#L173

jackd248 commented 1 year ago

Okay I see, using the setopt function is helping with this issue: https://github.com/deployphp/deployer/blob/master/src/Utility/Httpie.php#L141

thyseus commented 9 months ago

@jackd248 could you please give an example what you have written into your deploy.php to raise that timeout? Thanks a lot !

jackd248 commented 9 months ago

Hej @thyseus, i have only adjusted my task to send a notification, no global configuration.

Httpie::post(get('webhook'))
        ->setopt(CURLOPT_TIMEOUT, 10)
        ->jsonBody(
            [
                'text'       => $message
            ]
        )
        ->send();