mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00
Chunk Sushi
inserts based on rows count (#1259)
This commit is contained in:
parent
862afaa0e9
commit
22a0a52f7b
@ -33,6 +33,8 @@ class File extends Model
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected int $sushiInsertChunkSize = 100;
|
||||
|
||||
public const ARCHIVE_MIMES = [
|
||||
'application/vnd.rar', // .rar
|
||||
'application/x-rar-compressed', // .rar (2)
|
||||
@ -167,7 +169,7 @@ class File extends Model
|
||||
throw new Exception($contents['error']);
|
||||
}
|
||||
|
||||
return array_map(function ($file) {
|
||||
$rows = array_map(function ($file) {
|
||||
return [
|
||||
'name' => $file['name'],
|
||||
'created_at' => Carbon::parse($file['created'])->timezone('UTC'),
|
||||
@ -181,6 +183,10 @@ class File extends Model
|
||||
'mime_type' => $file['mime'],
|
||||
];
|
||||
}, $contents);
|
||||
|
||||
$this->sushiInsertChunkSize = min((int) floor(999 / count($this->getSchema())), count($rows));
|
||||
|
||||
return $rows;
|
||||
} catch (Exception $exception) {
|
||||
report($exception);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user