How does Inactivity Seconds actually work?

I am trying to use the system.util.getInactivitySeconds() function to log out users after X amount of time.

Someone has discovered an interesting behavior when the PC is put to sleep, and on resuming of the PC, the client is not logged out.
This may be due to our client timer script only executing every 60s, and a user resetting the inactivity seconds before the script is run.

However it would be nice to understand the underlying mechanics of how the inactivity seconds is calculated, and what expected behaviour would be with situations outside of Ignition client, such as:

  • PC being hibernated
  • PC going to sleep
  • VM being suspended

etc..

So this is not 100% confirmed but from my own experiences. If the computer is sleeping, hibernated, or suspended the script is not running. This is an assumption but would be easy to test and monitor from a secondary computer.

Every time something is done on the screen even not related to control or anything the inactivity resets. So if you are running every 60 seconds their is a lot of time for something to happen. Honestly you'd probably need to monitor it every 1 second to have any real solid feel of time for this.

Another option is kicking off a timer. But then they will have x amount of time before they get logged out activity or not. it can get a little tricky. I've tried managing it by window which can extend the time.

How long does the average user task take? Are their windows which must remain open for long periods of time?

This requires a bit more info . But I also dealt with PCs which were set to neve sleep (production floor). Office screens were less of a concern.

Coincidentally and conversely, Perspective inactivity is a bit different; mouse movement doesn't reset the timer, only interactions do which I guess makes sense with it being web tech with its security limitations

Seems reasonable, i would expect that the timer doesn't do anything if the entire system is suspended.

I think most of the time users are quite active, but there is a use case that has just popped up now where they may need to have a popup open to enter some "maintenance task data" and then physically go do something for quite some time, perhaps 30min.
Coming back after that time they have found themselves logged out with the initial data entry lost.
So need to either find a way to prevent logging out in this case (maybe check open windows for popups? ) or save the data in the popup somehow.

Ideally we'd keep data entry on popups saved via Client tags somehow, but these would also be lost during a session shutdown / startup as happens during logout.

I had a similar situation.

In my case their was a critical pasteurizer screen and having to re log in if something happens could be enough time to ruin a batch.

You can start/stop the timer on certain pages, or even check for a property to activate the log out sequence

How do you start or stop the inactivity timer on demand?

You can not start/stop inactivity.

You can start/stop timer.

You also could have an if statement with disable parameter. So if they navigate to page X you set disable to 1, when they leave the page you can set it to 0.

Or could link the disable with the active property of the timer.

1 Like