We have a system built with FuelPHP, and we encountered an issue regarding the following: We have some "users" which are actually just logins that need to stay online all the time, because they are on specific machines no one touches, so they just leave a page open to follow the data progress through specific pages. Which are all refreshed through AJAX requests.
Basically we set the session to expire for everyone for 20min. I have currently forced a Session rotate on the before, after a check if the user is those specific users. So everytime, as the session is rotated, the "updated" column is modified, therefore, garbage collection will avoid their session due to it is always being updated.
It doesn't seem to be working as expected, as the "updated" column is always, uh, updated, the garbage collection should avoid that specific session on the session expire calc.
What is the best approach for doing such thing?
I would also like to point something, before doing the Session::rotate() I've tried manually update the sessions table, the updated column itself, to the moment it was requested. However it didn't seem to work at all, like, the query was ran, however, at the end of the request, the "updated" column was still the same? What happened?
I have looked up the query with DB::last_query() and the query it produced do the proper update query for that specific session key, I highly doubt this happens for being due to AJAX calls?
You can not manually update the session table. Data in it is part of the control structure used internally, when the session is written all columns are updates (as you have noticed). Since this happens in the shutdown event, after you code has been finished, it will always overwrite whatever you have changed manually. Which should not be needed anyway.
Garbage collection runs on the updated column, deleting all records with an updated timestamp smaller than current-time minus the expiration time. So if your updated column is constantly updated, I don't see how that query could delete still active sessions. That would be a major bug.