laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

The failed_jobs insert error

Open tbryan24 opened this issue 3 years ago • 2 comments

  • 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)

tbryan24 avatar Apr 20 '22 00:04 tbryan24

I have same problem

playerarm123 avatar May 28 '23 16:05 playerarm123

https://jira.mongodb.org/browse/PHPORM-87

GromNaN avatar Sep 06 '23 16:09 GromNaN