Asynchronous background tasks

Enonic version: 6.6.2-SNAPSHOT
OS: Mac and Linux

Is there a way in serverside js to run some code in the background?

For instance I would like to respond with a page, quickly, while letting httpClient requests for preCaching images run in the background…

At this moment there is not a built-in way to run code in background in XP. If you need it now, you would have to write your own library in Java.

We are working on both a Java and JavaScript API to run tasks in background. Hopefully it will be included in 6.8, at least the plain run-in-background task .
Then there will be a scheduler handler on top of it, that might or might not come in 6.8