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
This commit is contained in:
parent
6fc0eb0236
commit
c2a7fff4f6
1 changed files with 3 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue