Hi! I was reviewing how daloRADIUS handles stale session cleanup in acct-maintenance-cleanup.php and noticed a difference between the cleanup strategy used for a specific user versus cleanup by date.
- When cleaning up by username, the system performs an
UPDATE:
UPDATE %s SET acctstoptime=NOW(), acctterminatecause='Admin-Reset'
WHERE username='%s' AND acctstoptime IS NULL
- However, when cleaning up by date, the system performs a
DELETE:
DELETE FROM %s
WHERE acctstarttime < '%s'
AND (acctstoptime = '0000-00-00 00:00:00' OR acctstoptime IS NULL)
In my application, maintaining an accurate and complete record of data usage is critical. I am planning to run a daily cron job to clean up expired sessions. However, I am concerned that using the date-based cleanup (DELETE) may remove historical session data that could still be relevant for accounting and reporting, and that using an UPDATE-based approach to close sessions might cause subsequent interim updates to fail to match the existing session, resulting in the creation of new sessions and potentially duplicating usage data.
Why was DELETE chosen instead of UPDATE for date-based cleanup? Is it safe to use the date-based cleanup in production environments where accounting accuracy is important?
Hi! I was reviewing how daloRADIUS handles stale session cleanup in
acct-maintenance-cleanup.phpand noticed a difference between the cleanup strategy used for a specific user versus cleanup by date.UPDATE:DELETE:In my application, maintaining an accurate and complete record of data usage is critical. I am planning to run a daily cron job to clean up expired sessions. However, I am concerned that using the date-based cleanup (DELETE) may remove historical session data that could still be relevant for accounting and reporting, and that using an UPDATE-based approach to close sessions might cause subsequent interim updates to fail to match the existing session, resulting in the creation of new sessions and potentially duplicating usage data.
Why was DELETE chosen instead of UPDATE for date-based cleanup? Is it safe to use the date-based cleanup in production environments where accounting accuracy is important?