Is context applied synchronously?

I have a server-side process that does something like this.

  1. Poll for a job request.
  2. Set context to details about the job
  3. Execute the job, and call Raven.captureException() on error.
  4. Reset to default context.
  5. 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?