mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 23:14:38 +01:00
Fix serialization during async construction
This commit is contained in:
parent
406a2d8aad
commit
4c52776de9
@ -100,7 +100,7 @@ class API extends APIFactory
|
||||
$pong = $this->ping(['ping_id' => 3], ['async' => true]);
|
||||
\danog\MadelineProto\Logger::log('Pong: ' . $pong['ping_id'], Logger::ULTRA_VERBOSE);
|
||||
\danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['madelineproto_ready'], Logger::NOTICE);
|
||||
});
|
||||
});
|
||||
$this->APIFactory();
|
||||
|
||||
return;
|
||||
|
@ -200,7 +200,7 @@ trait CallHandler
|
||||
if (is_array($args) && isset($args['id']['_']) && isset($args['id']['dc_id']) && $args['id']['_'] === 'inputBotInlineMessageID') {
|
||||
$aargs['datacenter'] = $args['id']['dc_id'];
|
||||
}
|
||||
if ($this->wrapper instanceof \danog\MadelineProto\API && isset($this->wrapper->session) && !is_null($this->wrapper->session) && time() - $this->wrapper->serialized > $this->settings['serialization']['serialization_interval']) {
|
||||
if ($this->wrapper instanceof \danog\MadelineProto\API && isset($this->wrapper->session) && !is_null($this->wrapper->session) && time() - $this->wrapper->serialized > $this->settings['serialization']['serialization_interval'] && !$this->asyncInitPromise) {
|
||||
$this->logger->logger("Didn't serialize in a while, doing that now...");
|
||||
$this->wrapper->serialize($this->wrapper->session);
|
||||
}
|
||||
|
@ -57,7 +57,13 @@ class Serialization
|
||||
if ($filename == '') {
|
||||
throw new \danog\MadelineProto\Exception('Empty filename');
|
||||
}
|
||||
|
||||
if ($instance->API->asyncInitPromise) {
|
||||
return $instance->call(static function () use ($filename, $instance, $force) {
|
||||
yield $instance->API->asyncInitPromise;
|
||||
$instance->API->asyncInitPromise = null;
|
||||
return self::serialize($filename, $instance, $force);
|
||||
});
|
||||
}
|
||||
if (isset($instance->API->setdem) && $instance->API->setdem) {
|
||||
$instance->API->setdem = false;
|
||||
$instance->API->__construct($instance->API->settings);
|
||||
|
Loading…
Reference in New Issue
Block a user