Skip to content

The failed_jobs insert error #2379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tbryan24 opened this issue Apr 20, 2022 · 3 comments
Closed

The failed_jobs insert error #2379

tbryan24 opened this issue Apr 20, 2022 · 3 comments

Comments

@tbryan24
Copy link

  • 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)
@playerarm123
Copy link

I have same problem

@GromNaN
Copy link
Member

GromNaN commented Sep 6, 2023

@GromNaN
Copy link
Member

GromNaN commented Apr 23, 2024

Fixed by #2838

@GromNaN GromNaN closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants