feat: retry transactions using withTransaction
Description
Changing to withTransaction instead of calling beginTransaction and start/rollback directly. This is a documented way to retry failing database operations to reduce errors from being unable to attain locks.
Related: https://github.com/payloadcms/payload/issues/4160 https://github.com/payloadcms/payload/issues/4133 https://github.com/payloadcms/payload/issues/4350 https://github.com/payloadcms/payload/issues/4273
- [x] I have read and understand the CONTRIBUTING.md document in this repository.
Type of change
- [x] New feature (non-breaking change which adds functionality)
Checklist:
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation
Any update on getting this merged @DanRibbens ?
I don't think this fix worked as I expected when I packaged it up and tried it in repos that could reproduce this issue. The PR should probably be closed until we can revisit it. However, I don't want to delete this branch yet so I've kept it open.