Today, in the analytics system of Seofy, I found a decrease in conversion from visiting the main page of the site to adding a site, so I began to investigate the reasons. I tried to add the site myself and hung up waiting for the server to respond and redirect to the next page of the user path funnel. Waited for about 30 seconds.
The culprit was Guzzle, who sent a request to an external resource and was waiting for a response, and the external resource was loaded so much that he had no time to respond.
As a result, I transferred this Guzzle request and Telegram alerts to the Laravel Model Observer, rewriting the code as follows:
exec('curl -s -X POST https://api.telegram.org/bot'.env('TELEGRAM_BOT_TOKEN').'/sendMessage -d chat_id='.env('TELEGRAM_GROUP_ID').' -d text="'.$text_to_send.'" --connect-timeout 5 > /dev/null 2>&1 &'); exec('curl -X POST http://'.env('BOT_ADDRESS','localhost').':8051/domains/'.$domain->id.'/start --connect-timeout 5 > /dev/null 2>&1 &');
Now this logic is launched from the command line, without waiting for the result.
Arsen Ibragimov@iamarsibragimov/done Make @seofyio faster
After: it's like 5 seconds needed to show the first website and content audit results to the user.
Before: loading... waiting... wtf...17:05 PM - 04 Jun 2020
I wonder what you think about it and how you would act in this situation.