-
Notifications
You must be signed in to change notification settings - Fork 15
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
async callbacks are not capturing the active domain #15
Comments
That is certainly true and unless it's implicitly included in the Scope/Closure, then the only thing that prevents the synchronous case from failing as well is that it's throws to the current context which is connected to the domain. I feel this one should also be a result of an oversight and will be straightforward to address. |
I've looked at the various blogs/documentation about how this is supposed to work, and supposedly it's all happen automatically so long as MakeCallback is used, but of course, that's not what's happening. So I'm going to have to fix this because it's obviously not working like it's supposed to but it will need to be a bug fix to 1.2. |
I suspect it is the first argument to Brandon
|
That's possible. However, this slideware especially slide 14 and in the node src here and here, this appears to more closely associated with the Environment (node internal) and derived from the 2nd parameter. Indeed that 2nd parameter is set to a global value which is likely wrong here What it should be set to instead, though... Ah, maybe it's Update: yes args.This() is null. in julia.eval. |
ah yes it is the 2nd argument I meant to say. Maybe you need to capture that global variable value at the start of eval() in order to capture the"current environment" for the callback. Brandon
|
Attempted that, and various other things but so far have not obtained the desired result. I feel that's very close to what needs to happen however. |
This proved to be harder than expected. But, what to do about calling JS-ified Julia structs seems not so straightforward. |
If using nodejs domains, then async callbacks should run in the context of the current domain.
This doesn't appear to be happening with node-julia.
Here's some unit tests.
The first one fails.
The 2nd one (passes) shows how it should work with an example from
setTimeout
.The 3rd one (passes) shows how if I manually bind my callback to the domain then it works.
The 4th one (fails) shows
domain.active
is not set correctlyThe 5th & 6th one show that it is set correctly when using
setTimeout
ordomain.bind
:It looks like the current domain (Context?) is not being captured when the work is queued?
The text was updated successfully, but these errors were encountered: