How to save the failed_at field as ISODate? #2605
Replies: 1 comment 1 reply
-
|
Reading the laravel code, I see that the type of the laravel-mongodb/src/Queue/Failed/MongoFailedJobProvider.php Lines 25 to 34 in 9bc8999 I agree that an UTCDateTime should be used. Would you like to submit a PR? Also, it looks like the Job Batching feature implemented in Laravel 8.x needs some update. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, Before telling the solution, I must say that if the configuration considered for
failed.driverin thequeue.phpfile isdatabase-uuidsby default, the value of thefailed_atfield in Mongo is an empty object and no date is stored in it.But if we change the driver to mongodb, you will see that the date is stored as a string of the
timestampvalue in thefailed_atfield. And this was not what I expected and I wanted the date to be stored as an ISODate.However, to save the date in the
failed_atfield as ISODate, you can take the following steps.Step 1:
Run the following command
Then rewrite the
CustomMongodbQueueServiceProvider.phpfile as below:Step 2:
Run the following command :
Then rewrite the
CustomMongoFailedJobProvider.phpfile as below:I think it is generally clear what we did, a simple override of two service providers related to
MongoFailedJobProvider,MongodbQueueServiceProviderthrough which we can rewrite thelogmethod according to our needs.Step 3:
Now we have to register our service provider in the
config/app.phpfile :Step 4:
Then run the following command :
Well, our work is finished, now you can test the result. I hope this solution helped you.
Beta Was this translation helpful? Give feedback.
All reactions