mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 03:34:42 +01:00
Fix serialization during async construction
This commit is contained in:
parent
406a2d8aad
commit
4c52776de9
@ -200,7 +200,7 @@ trait CallHandler
|
|||||||
if (is_array($args) && isset($args['id']['_']) && isset($args['id']['dc_id']) && $args['id']['_'] === 'inputBotInlineMessageID') {
|
if (is_array($args) && isset($args['id']['_']) && isset($args['id']['dc_id']) && $args['id']['_'] === 'inputBotInlineMessageID') {
|
||||||
$aargs['datacenter'] = $args['id']['dc_id'];
|
$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->logger->logger("Didn't serialize in a while, doing that now...");
|
||||||
$this->wrapper->serialize($this->wrapper->session);
|
$this->wrapper->serialize($this->wrapper->session);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,13 @@ class Serialization
|
|||||||
if ($filename == '') {
|
if ($filename == '') {
|
||||||
throw new \danog\MadelineProto\Exception('Empty 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) {
|
if (isset($instance->API->setdem) && $instance->API->setdem) {
|
||||||
$instance->API->setdem = false;
|
$instance->API->setdem = false;
|
||||||
$instance->API->__construct($instance->API->settings);
|
$instance->API->__construct($instance->API->settings);
|
||||||
|
Loading…
Reference in New Issue
Block a user