mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-23 05:51:14 +01:00
Abort if the lock cannot be acquired
This commit is contained in:
parent
e298dbc6b4
commit
eaa5e30bf1
@ -288,7 +288,7 @@ class API extends InternalDoc
|
|||||||
*
|
*
|
||||||
* @return \Generator
|
* @return \Generator
|
||||||
*/
|
*/
|
||||||
protected function connectToMadelineProto(SettingsAbstract $settings, bool $forceFull = false): \Generator
|
protected function connectToMadelineProto(SettingsAbstract $settings, bool $forceFull = false, bool $tryReconnect = true): \Generator
|
||||||
{
|
{
|
||||||
if ($settings instanceof SettingsIpc) {
|
if ($settings instanceof SettingsIpc) {
|
||||||
$forceFull = $forceFull || $settings->getSlow();
|
$forceFull = $forceFull || $settings->getSlow();
|
||||||
@ -306,9 +306,12 @@ class API extends InternalDoc
|
|||||||
if ($unserialized === 0) {
|
if ($unserialized === 0) {
|
||||||
// Timeout
|
// Timeout
|
||||||
Logger::log("!!! Could not connect to MadelineProto, please check and report the logs for more details. !!!", Logger::FATAL_ERROR);
|
Logger::log("!!! Could not connect to MadelineProto, please check and report the logs for more details. !!!", Logger::FATAL_ERROR);
|
||||||
|
if (!$tryReconnect) {
|
||||||
|
throw new Exception('Could not connect to MadelineProto, please check the MadelineProto.log file to debug!');
|
||||||
|
}
|
||||||
Logger::log("!!! Reconnecting using slower method. !!!", Logger::FATAL_ERROR);
|
Logger::log("!!! Reconnecting using slower method. !!!", Logger::FATAL_ERROR);
|
||||||
// IPC server error, try fetching full session
|
// IPC server error, try fetching full session
|
||||||
return yield from $this->connectToMadelineProto($settings, true);
|
return yield from $this->connectToMadelineProto($settings, true, false);
|
||||||
} elseif ($unserialized instanceof \Throwable) {
|
} elseif ($unserialized instanceof \Throwable) {
|
||||||
// IPC server error, try fetching full session
|
// IPC server error, try fetching full session
|
||||||
return yield from $this->connectToMadelineProto($settings, true);
|
return yield from $this->connectToMadelineProto($settings, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user