This commit is contained in:
2023-09-11 11:02:34 +08:00
parent 370c50f1fe
commit 6be1180962
+5 -4
View File
@@ -137,9 +137,10 @@ class BackupCommand extends Command
for ($i = 0; $i < 200; $i++) { for ($i = 0; $i < 200; $i++) {
Coroutine::create(function () use ($channel, $path, $dbname, $tableName) { Coroutine::create(function () use ($channel, $path, $dbname, $tableName) {
while ($channel->errCode != SWOOLE_CHANNEL_CLOSED) { while ($channel->errCode != SWOOLE_CHANNEL_CLOSED) {
$value = json_decode($channel->pop(), true); if (($data = $channel->pop()) === false) {
break;
if ($value === null) { }
if (($value = json_decode($data, true)) === null) {
continue; continue;
} }
@@ -175,7 +176,7 @@ class BackupCommand extends Command
$database = \Kiri::service()->get($dbname); $database = \Kiri::service()->get($dbname);
$data = $database->createCommand("SELECT * FROM $tableName LIMIT $offset,$size")->all(); $data = $database->createCommand("SELECT * FROM $tableName LIMIT $offset,$size")->all();
if (count($data) < 1) { if (is_bool($data) || count($data) < 1) {
return; return;
} }
$channel->push(json_encode($data)); $channel->push(json_encode($data));