A Transactional Method Decorator for TypeORM that uses Async Local Storage or cls-hooked to handle and propagate transactions between different repositories and service methods.
MIT License
213
stars
28
forks
source link
[Question] @Transactional on controller level and nested transaction errors #37
I've noticed that the examples all dictate service-level transactions. But may I ask if controller level transactions are okay?
Note: I have GET endpoints use the propagation level of SUPPORTS because for some reason when I have my FE do concurrent GET requests it'll throw a SQLITE_ERROR: cannot start a transaction within a transaction
tldr
Are controller level transactions are okay?
GET endpoints with transactions throw SQLITE_ERROR: cannot start a transaction within a transaction when hit concurrently, what's the proper way to fix this case? I was under the impression that REQUIRES_NEW (default) supports current transaction instead of starting new when there's one
Currently I have this on my NestJS application on the controller level
Controller level:
Service Level:
Datasource
I've noticed that the examples all dictate service-level transactions. But may I ask if controller level transactions are okay? Note: I have GET endpoints use the propagation level of SUPPORTS because for some reason when I have my FE do concurrent GET requests it'll throw a
SQLITE_ERROR: cannot start a transaction within a transaction
tldr
SQLITE_ERROR: cannot start a transaction within a transaction
when hit concurrently, what's the proper way to fix this case? I was under the impression that REQUIRES_NEW (default) supports current transaction instead of starting new when there's one