-
Notifications
You must be signed in to change notification settings - Fork 18
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
a promise which returns a promise gets stuck in pending #45
Comments
This also gets stuck in pending
So it does not seem to be a problem with having a future within the future (which was my first guess). I little playing around shows that the issue is with calling
prints hi and returns NULL, while
just returns NULL and never prints hi. Presumably, in this case, the function passed to |
I'm on vacation so I won't be investigating this immediately, but my guess is that this is related to future topology (https://cran.r-project.org/web/packages/future/vignettes/future-3-topologies.html). If a future is run with a sequential plan() (which is the default for nested futures) then it will not ever resolve. I would be surprised if most use cases for nested futures could not be rewritten to unnest the futures, though...? (Nesting promises, on the other hand, is natural and often necessary) |
No problem. Enjoy your vacation! I am gonna record my thoughts and you can come back to this on your time. I do not have much rush. I think my second example (with the
prints 3 after about 2 secs as I was expecting initially. The |
This works
and prints 2 after about 2 secs (as expected).
This does not work
the returned promise is stuck in pending. I was expecting/hoping to see 3 printed after about 2 secs.
I was playing around with promises and ended up with a promise which used a piped promise (more or less like the above) in its calculation, but it never resolves, making the above pattern useless. Is this intentional? I am new to this, so perhaps there are fundamental problems with promises returning promises The first example makes me think it is not so much 'promises returning promises' (which seems to be fine in the simple example), but 'promises returning pipes' which is kind of strange...
The text was updated successfully, but these errors were encountered: