Hey Dojo,
I'm working with a GQI that uses Live-Updates. When I leave it open for some time on a tab I'm not looking at, it seems that the Live-Updates stop working because the GQI calls OnDestroy and unsubscribes from the updates, but when I open the tab, the GQI looks perfectly fine as though nothing has happened.
I'm aware that the GQI receives heartbeats from the browser to stay active, but I'd like to know if inactive tabs aren't able to send those heartbeats? I'd also like to know how I can avoid having situations where the GQI looks active but isn't really.
Thank you,
Bauti
Hi Bautista,
There are a few reasons why the OnDestroy lifecycle method of a GQI extension instance might get called, usually because the entire query session was closed.
If the client did not explicitly close the query session, it can expire after no heartbeats are received for some time. Inactive browser tabs still send these heartbeats, although they may sometimes be throttled.
The browser heartbeats keep the WebAPI connection alive. As long as that connection exists, the WebAPI will keep all query sessions created through that connection alive as well. If the connection is lost, the browser application will display a banner asking the user to reload the tab.
Apart from that, OnDestroy can also be called in the following two scenarios:
- The query session is closed because the connection between the GQI service and the DataMiner agent is lost. This can happen when the agent is stopped, restarted, upgraded, or when certain configuration changes are applied. In that case, all extensions are destroyed because the existing connections are no longer valid.
- The GQI extension script or library is modified or recompiled. This invalidates any existing queries that use the extension.
In these scenarios, the browser will not be aware that the query session is no longer valid until additional data is requested. At the moment, there is no way to avoid this, but these situations should be rare.
The GQI logs can be used to verify what caused the query session to close.
If you suspect something else might be going on, feel free to reach out to our support team.