Skip to content
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

feat: wrap use-case in transaction #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rickdgeerling
Copy link
Owner

@rickdgeerling rickdgeerling commented May 23, 2023

If you want to review by commit, you can watch the POC build up:

  1. Makes the TypeORM repositories request-scoped, using either the transaction-scoped queryRunner, or the root dataSource. This allows us to wrap a use-case in a transaction at the controller-level.
  2. Optimize the strategy by caching repositories that are not transaction-scoped, by leveraging durable providers.

@rickdgeerling rickdgeerling force-pushed the feat/durable-transactions branch 2 times, most recently from cbb457c to 189e165 Compare July 26, 2023 15:22
provide: getRepositoryToken(entity),
inject: [REQUEST, getDataSourceToken()],
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Injecting the REQUEST automatically disqualifies this from being durable, because it has a dependency that's not durable.

@rickdgeerling rickdgeerling force-pushed the feat/durable-transactions branch from 189e165 to c960ba1 Compare July 27, 2023 06:44
@rickdgeerling rickdgeerling force-pushed the feat/durable-transactions branch from c960ba1 to d145c54 Compare July 27, 2023 06:50
We can cache the repositories outside transactions by leveraging durable
providers
@rickdgeerling rickdgeerling force-pushed the feat/durable-transactions branch from d145c54 to 432fcba Compare July 27, 2023 06:57
@rickdgeerling rickdgeerling force-pushed the master branch 4 times, most recently from 41acece to cf8ec12 Compare October 30, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant