Answer the question
In order to leave comments, you need to log in
PHP sleeps between requests, how to wake it up?
sleep(1)
"Sorry, please wait for the completion of the previous operation."
<?php
if ($bot->isMessage() && !$bot->isCommand()) {
if ($bot->state_name == 'process') {
$bot->reply('Please, wait until the previous search is complete.');
die;
} else {
$bot->setState('process');
}
$GLOBAL_STATUS = $bot->cache->get('GLOBAL_STATUS');
if ($GLOBAL_STATUS == 'process') {
$bot->clearState();
$bot->reply('Queue busy, please try again later.');
die;
} else {
$bot->cache->add('GLOBAL_STATUS', 'process', 60);
}
$bot->hear(['{default}'], function() use($bot) {
$bot->reply(' Search, it takes ~10 seconds...');
$q = $bot->message;
// здесь как раз 10 итераций интервалом в sleep(1)
$data = search($q, 100, $bot->user->data['sort']);
$bot->say('OK, search completed.');
});
}
Answer the question
In order to leave comments, you need to log in
So you have a logic failure in your code, the situation is processed incorrectly ...
That's it, the problem is solved?
PS And what do you want, what is the question - such is the answer.
Without full source codes, no one will point a finger at the error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question