I have a telegram Bot hosted on Heroku.
It needs to grab some content from a website
Parse it and send a messege to the user
$params['text'] = getRemoteContent("https://example.com/someData");
$t->send('sendMessage', $params);
but it exits after 30 seconds
2020-12-23T15:04:54.995957+00:00 app[web.1]: [23-Dec-2020 15:04:54] WARNING: [pool www] child 295, script '/app/index.php' (request: "GET /index.php?q=data&chat_id=000672000") execution timed out (30.626797 sec), terminating
I tried .user.ini but no change in results it still exits after 30 seconds
max_execution_time = 400
2
Answers
try to reset your apache after change php.ini.
other way, write
This is a bad practice, it is better to write code that will shorten the loading time, for example to make processes work in parallel.
updating:
I saw you running on the "heroku".
From a peek at their documentation, if you have to go over the 30s request timeout, you’ll need to use a background job:
https://devcenter.heroku.com/articles/request-timeout
Now this goes into more details and mentions an additional 55-second window: HTTP timeouts (in their article about Limits.)