Fix serialization
This commit is contained in:
parent
a6b4c0f5cf
commit
f5e4d29db1
@ -187,9 +187,9 @@ class API extends InternalDoc
|
||||
protected function connectToMadelineProto(SettingsAbstract $settings, bool $forceFull = false): \Generator
|
||||
{
|
||||
if ($settings instanceof SettingsIpc) {
|
||||
$forceFull = $forceFull || $settings->getForceFull();
|
||||
$forceFull = $forceFull || $settings->getSlow();
|
||||
} elseif ($settings instanceof Settings) {
|
||||
$forceFull = $forceFull || $settings->getIpc()->getForceFull();
|
||||
$forceFull = $forceFull || $settings->getIpc()->getSlow();
|
||||
}
|
||||
|
||||
[$unserialized, $this->unlock] = yield Tools::timeoutWithDefault(
|
||||
|
@ -125,7 +125,7 @@ final class APIWrapper
|
||||
*/
|
||||
public static function __sleep(): array
|
||||
{
|
||||
return ['API', 'webApiTemplate', 'gettingApiId', 'myTelegramOrgWrapper', 'storage', 'lua']; //, 'async'];
|
||||
return ['API', 'webApiTemplate', 'gettingApiId', 'myTelegramOrgWrapper', 'storage', 'lua'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,6 +159,15 @@ abstract class AbstractAPIFactory extends AsyncConstruct
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* Sleep function.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
/**
|
||||
* Call async wrapper function.
|
||||
*
|
||||
|
@ -97,7 +97,7 @@ use danog\MadelineProto\Tools;
|
||||
Magic::classExists();
|
||||
Magic::$script_cwd = $_GET['cwd'] ?? Magic::getcwd();
|
||||
|
||||
$API = new API($ipcPath, (new Ipc)->setForceFull(true));
|
||||
$API = new API($ipcPath, (new Ipc)->setSlow(true));
|
||||
$API->init();
|
||||
$API->initSelfRestart();
|
||||
|
||||
|
@ -11,7 +11,7 @@ class Ipc extends SettingsAbstract
|
||||
*
|
||||
* WARNING: this will cause slow startup if enabled.
|
||||
*/
|
||||
protected bool $forceFull = false;
|
||||
protected bool $slow = false;
|
||||
|
||||
public function mergeArray(array $settings): void
|
||||
{
|
||||
@ -22,21 +22,23 @@ class Ipc extends SettingsAbstract
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getForceFull(): bool
|
||||
public function getSlow(): bool
|
||||
{
|
||||
return $this->forceFull;
|
||||
return $this->slow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set WARNING: this will cause slow startup if enabled.
|
||||
* Whether to force full deserialization of instance, without using the IPC server/client.
|
||||
*
|
||||
* WARNING: this will cause slow startup if enabled.
|
||||
*
|
||||
* @param bool $forceFull WARNING: this will cause slow startup if enabled.
|
||||
* @param bool $slow WARNING: this will cause slow startup if enabled.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setForceFull(bool $forceFull): self
|
||||
public function setSlow(bool $slow): self
|
||||
{
|
||||
$this->forceFull = $forceFull;
|
||||
$this->slow = $slow;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user