Move flood waiting time value to settings (#50)

This commit is contained in:
Gregory Ostrovsky 2017-01-24 18:32:39 +03:00 committed by Daniil Gentili
parent 5751bbca8c
commit c4735c9a61
2 changed files with 4 additions and 1 deletions

View File

@ -193,6 +193,9 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
'authorization' => 5, // How many times should I try to generate an authorization key before throwing an exception
'response' => 5, // How many times should I try to get a response of a query before throwing an exception
],
'flood_timeout' => [
'wait_if_lt' => 20, // Sleeps if flood block time is lower than this
],
'msg_array_limit' => [ // How big should be the arrays containing the incoming and outgoing messages?
'incoming' => 1000,
'outgoing' => 1000,

View File

@ -91,7 +91,7 @@ trait CallHandler
case 420:
if ($this->settings['pwr']['pwr']) {
$seconds = preg_replace('/[^0-9]+/', '', $server_answer['error_message']);
if (is_numeric($seconds) && $seconds < 20) {
if (is_numeric($seconds) && $seconds < $this->settings['flood_timeout']['wait_if_lt']) {
\danog\MadelineProto\Logger::log('Flood, waiting '.$seconds.' seconds...');
sleep($seconds);
throw new \danog\MadelineProto\Exception('Re-executing query...');