Improve composer.json and serialization

This commit is contained in:
Daniil Gentili 2019-05-13 17:48:53 +02:00
parent 28afd56d54
commit da561de1a9
2 changed files with 8 additions and 8 deletions

View File

@ -12,7 +12,7 @@
"php": ">=5.6.0",
"danog/primemodule": "^1.0.3",
"danog/magicalserializer": "^1.0",
"phpseclib/phpseclib": "dev-master#27370df",
"phpseclib/phpseclib": "dev-master#27370df as 2.0.15",
"vlucas/phpdotenv": "^2.4",
"erusev/parsedown": "^1.6",
"rollbar/rollbar": "dev-master",

View File

@ -57,13 +57,6 @@ 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);
@ -71,6 +64,13 @@ class Serialization
if ($instance->API === null && !$instance->getting_api_id) {
return false;
}
if ($instance->API && $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);
})());
}
$instance->serialized = time();
$realpaths = self::realpaths($filename);
if (!file_exists($realpaths['lockfile'])) {