nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.04k stars 533 forks source link

Support read replicas #778

Open panuhorsmalahti opened 2 years ago

panuhorsmalahti commented 2 years ago

The framework should support read replicas for databases. Although the read replica can be configured in database configuration, the current implementation causes errors due to race conditions. For example in createOne, the new entity would be saved to the master database, but the saved entity would then be immediately read from the read replica, which could still be missing. (See https://github.com/nestjsx/crud/blob/master/packages/crud-typeorm/src/typeorm-crud.service.ts#L141).