I have a server-side process that does something like this.
- Poll for a job request.
- Set context to details about the job
- Execute the job, and call Raven.captureException() on error.
- Reset to default context.
- Repeat from 1.
I’m pretty sure I am observing that if there is an error in 3, it does not include the context from 2. Instead, it uses the context in 4, as if captureException doesn’t use the context defined immediately when it is called, but perhaps reads it asynchronously some small time later.
If I introduce a delay between 3 and 4, the appropriate context is used. Can someone tell me for certain one way or the other how this works?