Skip to content
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

feat: support for async function #2

Open
ColinFay opened this issue Sep 26, 2022 · 1 comment
Open

feat: support for async function #2

ColinFay opened this issue Sep 26, 2022 · 1 comment

Comments

@ColinFay
Copy link
Member

Following a conversation with @psolymos:

Create a add_endpoint_async that will create the skeleton for a promise based endpoint handler.

Maybe add the information in the YAML so that when building the plumber.R file and running the API in run_dev

@psolymos
Copy link
Contributor

Example skeleton:

library(promises)
library(future.callr)
plan(callr, workers = 2L)

#* @post /async_endpoint
function(req, res, callback) {
    if (missing(callback))
        callback <- NULL
    promises::future_promise({
        FUN(..., callback = callback)
    })
    list("Async job started")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants