Skip to content

How to run_now() with_temp_loop()? #165

@mmuurr

Description

@mmuurr

I'm probably missing something very obvious here, but I'm also completed stumped as to how to use with_temp_loop().
Here's a trivial global-loop example:

later::later(function() print("foo"), delay = 2)

Works great; prints "foo" after a few seconds.

Now I wanted to pop this onto a different (i.e. non-global) loop ... one way is to formally create a loop and use that loop's reference. Per the documentation, for a one-time-only later execution we can also do something like this(?):

later::with_temp_loop(
  later::later(function() print("foo"), delay = 2)
)

But this never seems to execute. And since temp loops are created with parent=NULL (and thus the global loop's run_now() doesn't trigger this temp loop to run), it's not obvious to me how to force execution with run_now() (since we don't have a reference to the loop).

Perhaps related to rstudio/httpuv#250?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions