wintercg / proposal-common-minimum-api

https://common-min-api.proposal.wintercg.org/
Other
216 stars 15 forks source link

Initial draft of AsyncLocalStorage interoperable subset #38

Closed jasnell closed 1 year ago

jasnell commented 1 year ago

@Qard:

Can we add AsyncLocalStorage.bind(...) as a wrapper for the Node.js use of it to abstract away those additional irrelevant bits?

Let's separate this conversation. I have some concerns about the feasibility of per-AsyncLocalStorage propagation rules given the O(n) complexity that introduces.

Qard commented 1 year ago

Per-storage binding we can put aside, but I think a global bind would be suitable as a direct equivalent to AsyncResource, and matches what AsyncContext proposed with its wrap function.

jasnell commented 1 year ago

@Qard :

Per-storage binding we can put aside, but I think a global bind would be suitable as a direct equivalent to AsyncResource, and matches what AsyncContext proposed with its wrap function.

Let's take discussion about adding an AsyncLocalStore.bind(...) to a Node.js issue or PR. I'm in favor if the semantics are really just an alias for AsyncResource.bind(...) but I think there are a few other details to consider before we can replace AsyncResource and it's just better to discuss those details over there.

jasnell commented 1 year ago

Given that I think we have reasonable agreement on the basic API itself, I'm going to go ahead and merge this and we can continue to tweak as necessary with individual PRs