Heartbeat active while long process is running?

Hello Forum,

I would like to know if the heartbeat could be checked with getLastHeartbeatTimestamp() from another thread while the main process is (UI) is running and still had not responsed to the browser because it is running for a long time.

Assume I use a heartbeat of 20 seconds and a process requested from the browser is running longer (30 secs).

Or could it be that the heartbeat is suspended as long as the browser has not response from the server?

Regards

Alex

Hi, if it’s a single synchronous long-living HTTP request then it is going to prevent heartbeing requests from being handled, as the session is locked by the long-running request. This is one of the reasons computations that take a long time should preferably be done in a separate worker thread, freeing the server to serve other requests in the same session.

In principle, heartbeat updating is one of those things that could probably be done using an atomic variable without locking the full session, but the basic philosophy in Vaadin is to avoid any extra complexity with regard to concurrency handling.