zijin-m edited a comment on pull request #27: URL: https://github.com/apache/skywalking-nodejs/pull/27#issuecomment-768208395
> > After testing, if two requests are repeatedly sent in a short time, the subsequent requests may use the `AsyncState` initialized by the previous request. It is temporarily unclear why `store.enterWith(undefined as unknown as AsyncState)` in the `clear` method not work(The store cannot be reset), I tried to add an `invalid` flag, which works normally, I hope to discuss the feasibility of this implementation with you, thx > > So if I understand this correctly it is a fix for a bug in `AsyncLocalStorage` where `getStore()` may return the previous context after `enterWith()` sets a new one? According to @qard's reply [comment](https://github.com/nodejs/node/issues/35286#issuecomment-697251574) this feature should be regarded as a feature rather than a bug. Maybe this is the expected behavior of enterWith. I guess it may be related to the order of calling `getStore` and `enterWith`, `get asyncState()` did not get it To the value of `enterWith` set (undefined), but the previous value, @qard [mentioned](https://github.com/nodejs/node/issues/35286#issuecomment-697254020) `The "value" of the context between before and after hooks should be whatever the value was at the time the resource init event happened. ` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
