fix: Moving migration to be inside coroutine completely
This commit is contained in:
parent
8f0294f9cb
commit
8e7cc6ed14
3 changed files with 48 additions and 50 deletions
|
@ -171,7 +171,6 @@ abstract class Migration
|
|||
|
||||
Console::log('Migrating Collection ' . $collection['$id'] . ':');
|
||||
|
||||
\Co\run(function (array $collection, callable $callback) {
|
||||
foreach ($this->documentsIterator($collection['$id']) as $document) {
|
||||
go(function (Document $document, callable $callback) {
|
||||
if (empty($document->getId()) || empty($document->getCollection())) {
|
||||
|
@ -193,7 +192,6 @@ abstract class Migration
|
|||
}
|
||||
}, $document, $callback);
|
||||
}
|
||||
}, $collection, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -816,7 +816,6 @@ class V19 extends Migration
|
|||
|
||||
Console::log('Migrating Collection ' . $collection['$id'] . ':');
|
||||
|
||||
\Co\run(function (array $collection, callable $callback) {
|
||||
foreach ($this->documentsIterator($collection['$id']) as $document) {
|
||||
go(function (Document $document, callable $callback) {
|
||||
if (empty($document->getId()) || empty($document->getCollection())) {
|
||||
|
@ -838,7 +837,6 @@ class V19 extends Migration
|
|||
}
|
||||
}, $document, $callback);
|
||||
}
|
||||
}, $collection, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,11 @@ class Migrate extends Action
|
|||
->inject('dbForConsole')
|
||||
->inject('getProjectDB')
|
||||
->inject('register')
|
||||
->callback(fn ($version, $dbForConsole, $getProjectDB, Registry $register) => $this->action($version, $dbForConsole, $getProjectDB, $register));
|
||||
|
||||
->callback(function ($version, $dbForConsole, $getProjectDB, Registry $register) {
|
||||
\Co\run(function () use ($version, $dbForConsole, $getProjectDB, $register) {
|
||||
$this->action($version, $dbForConsole, $getProjectDB, $register);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private function clearProjectsCache(Document $project)
|
||||
|
@ -50,7 +53,6 @@ class Migrate extends Action
|
|||
}
|
||||
}
|
||||
} while ($iterator > 0);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
Console::error('Failed to clear project ("' . $project->getId() . '") cache with error: ' . $th->getMessage());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue