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: add transactionAsyncLocalStorage option to opt in to automatically setting session on all transactions #14742

Merged
merged 5 commits into from
Jul 19, 2024

Conversation

vkarpov15
Copy link
Collaborator

Backport #14583 to 7.x
Re: #13889

Summary

Add transactionAsyncLocalStorage option to 7.x. Should work fine because Node v14.x has "experimental" support for the same AsyncLocalStorage API that became stable in 16.x.

Examples

…lly setting session on all transactions

Backport #14583 to 7.x
Re: #13889
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

Code looks good to me, though i would recommend to add a note to the documentation that it makes use of a experimental nodejs API below 16.4.0 (as added in the types by me and listed under AsyncLocalStorage's History).

also i just noticed that option transactionAsyncLocalStorage (in latest docs) only returns a result for docs/transactions.html, maybe it should be mentioned as a possible option for mongoose.set.

aside from that, there are some minor doc suggestions that should be done.

docs/transactions.md Outdated Show resolved Hide resolved
types/mongooseoptions.d.ts Outdated Show resolved Hide resolved
vkarpov15 and others added 3 commits July 12, 2024 10:39
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
@vkarpov15 vkarpov15 requested a review from hasezoey July 12, 2024 15:14
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

LGTM, would wait until #14744 is merged (and included here) before approving

@vkarpov15 vkarpov15 added this to the 7.8.0 milestone Jul 15, 2024
…session option with transactionAsyncLocalStorage; backport #14744
@vkarpov15
Copy link
Collaborator Author

@hasezoey I backported #14744 in e909e0b, can you take a look?

@vkarpov15 vkarpov15 merged commit 5a71c3e into 7.x Jul 19, 2024
63 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-13889-7.x branch July 19, 2024 18:34
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.

2 participants