Skip to content

The failed_jobs insert error #2379

Closed
Closed
@tbryan24

Description

@tbryan24
  • Laravel-mongodb Version: #.#.#
  • PHP Version: #.#.#
  • Database Driver & Version:

Description:

Steps to reproduce

1.add a job
2.throw exception in job
3.

Expected behaviour

There has error if insert more than one record into failed_jobs table
error message : duplicate key error collection: life_moments.failed_jobs index: uuid_1 dup key: { uuid: null }

Actual behaviour

Rewrite log method from MongoFailedJobProvider.php
add
public function log($connection, $queue, $payload, $exception)
{
$failed_at = Carbon::now()->getTimestamp();

    $uuid = json_decode($payload, true)['uuid'];//add this ,because uuid is unique

    $exception = (string) $exception;

    $this->getTable()->insert(compact('uuid','connection', 'queue', 'payload', 'failed_at', 'exception'));
}
Logs: Insert log.txt here (if necessary)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions