Skip to content
Snippets Groups Projects
Commit c2a7fff4 authored by Robin Appelman's avatar Robin Appelman
Browse files

throw an exception when trying to push a background job that wont fit in the table

otherwise it will lead to failures in json decode and unexpected and hard to debug issues when running the job
parent 6fc0eb02
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,9 @@ class JobList implements IJobList {
$class = $job;
}
$argument = json_encode($argument);
if (strlen($argument) > 2048) {
throw new \InvalidArgumentException('Background job arguments cant exceed 2048 characters (json encoded');
}
$query = $this->conn->prepare('INSERT INTO `*PREFIX*jobs`(`class`, `argument`, `last_run`) VALUES(?, ?, 0)');
$query->execute(array($class, $argument));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment