diff --git a/src/Db/DriverArray.php b/src/Db/DriverArray.php index 98a134291..6e4724a70 100644 --- a/src/Db/DriverArray.php +++ b/src/Db/DriverArray.php @@ -171,6 +171,7 @@ abstract class DriverArray implements DbArray, IteratorAggregate Logger::log("Loading data to table {$newName}: $counter/$total", Logger::WARNING); } } + if ($promises) await($promises); if (self::getMigrationName($new, false) !== self::getMigrationName($old, false)) { Logger::log("Dropping data from table {$oldName}", Logger::WARNING); $old->clear(); diff --git a/src/MTProto.php b/src/MTProto.php index e908ee5c8..609f09fe7 100644 --- a/src/MTProto.php +++ b/src/MTProto.php @@ -850,12 +850,22 @@ final class MTProto implements TLCallback, LoggerGetter $this->chats, $this->full_chats, ); - DbPropertiesFactory::get( + // Todo for when the username db is global + /*DbPropertiesFactory::get( $this->settings->getDb(), $this->getDbPrefix().'_MTProto_usernames', ['innerMadelineProto' => true], $this->usernames - )->clear(); + )->clear();*/ + } + + if (!isset($this->TL)) { + $this->TL = new TL($this); + $callbacks = [$this, $this->referenceDatabase]; + if (!($this->authorization['user']['bot'] ?? false)) { + $callbacks[] = $this->minDatabase; + } + $this->TL->init($this->settings->getSchema(), $callbacks); } }