From 038504fbec3713ba4274b4310a746798dec3192c Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Thu, 17 Apr 2025 22:24:57 +0200 Subject: [PATCH] Only chunk if rows exceeds sqlite variables limit (999) (#1270) --- app/Models/File.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/File.php b/app/Models/File.php index b2ceaed5c..12479554b 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -184,7 +184,11 @@ class File extends Model ]; }, $contents); - $this->sushiInsertChunkSize = min((int) floor(999 / count($this->getSchema())), count($rows)); + $rowCount = count($rows); + $limit = 999; + if ($rowCount > $limit) { + $this->sushiInsertChunkSize = min(floor($limit / count($this->getSchema())), $rowCount); + } return $rows; } catch (Exception $exception) {