Problem : I'm trying to make a long running task non blocking using async from coro in ambiorix but still getting blocked / delayed even though the function is asynchronously declared.
Goal : To let the server handle other requests in the meantime.
Current Behavior : When hitting the /long-task endpoint, the server blocks for 10 seconds due to Sys.sleep(10) before responding. During this time, no other requests can be handled.
Note : It would be helpful if asynchronous approach can be done using coro libraries as it looks more similar to JavaScript.
Main thing to notice is that I'm not using await(). I cannot use await here like this router$get("/ping", await(servePingInfo)). This throws an error
I have though a little for async in ambiorix too. I think it's worth exploring similar approach as ExtendedTask + furure/mirai.
Correct me if i'm wrong @JohnCoene, I think the current approach is using belgic.
The way we have async is just using future, see here, we can consider support for coro, i just need to understand the library a bit more to know what needs adapting in Ambiorix.
Belgic is a vertical load balancer for ambiorix, similar to shiny server.
Problem : I'm trying to make a long running task non blocking using
async
fromcoro
inambiorix
but still getting blocked / delayed even though the function is asynchronously declared.Goal : To let the server handle other requests in the meantime.
Reproducible Example :
app.R
router.R
controller.R
Current Behavior : When hitting the
/long-task
endpoint, the server blocks for 10 seconds due toSys.sleep(10)
before responding. During this time, no other requests can be handled.Note : It would be helpful if asynchronous approach can be done using
coro
libraries as it looks more similar to JavaScript. Main thing to notice is that I'm not usingawait()
. I cannot use await here like thisrouter$get("/ping", await(servePingInfo))
. This throws an error