- First commit to issue fork.
- π¬π§United Kingdom c_archer Cumbria
Ran into this issue, have created a patch implementing mglaman's idea
For reasons we have not yet been able to determine, we get jobs inserted to the database without a payload, randomly. These get stuck in processing and then error out. It gets constructed correctly, otherwise the Job constructor would error.
But yet we have a bad record saved
MariaDB [main]> select * from advancedqueue where payload = '';
+---------+------------+-----------------------------+---------+------------+---------+-------------+------------+-----------+------------+
| job_id | queue_id | type | payload | state | message | num_retries | available | processed | expires |
+---------+------------+-----------------------------+---------+------------+---------+-------------+------------+-----------+------------+
| 1758950 | order_jobs | JOB_TYPE | | processing | NULL | 0 | 1588427412 | 0 | 1588953615 |
+---------+------------+-----------------------------+---------+------------+---------+-------------+------------+-----------+------------+
Which gives us
/app/workers/../bin/drush advancedqueue:queue:process order_jobs: In Job.php line 99:
Missing property "payload"
π€·ββοΈ So it's fine when we do
$job = Job::create('JOB_TYPE', [
'order_id' => $order->id(),
'order_line_items' => $order_line_items,
]);
$queue->enqueueJob($job);
But for some reason it enqueued and writes incorrectly. The only thing I can think of is that JSON encoding somehow fails?
From the Database enqueueJobs:
$fields = $job->toArray();
unset($fields['id']);
$fields['payload'] = json_encode($fields['payload']);
// InsertQuery supports inserting multiple rows at once, which is faster,
// but that doesn't give us the inserted job IDs.
$query = $this->connection->insert('advancedqueue')->fields($fields);
Regardless, the following should cause the job to fail, not halt queue processing
public function __construct(array $definition) {
foreach (['type', 'payload', 'state'] as $required_property) {
if (empty($definition[$required_property])) {
throw new \InvalidArgumentException(sprintf('Missing property "%s"', $required_property));
}
}
Needs work
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Ran into this issue, have created a patch implementing mglaman's idea