Delete firstVisit = true, userID = 0 sessions after processing background queue
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 19 Feb 2019 15:32:00 +0000 (16:32 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 15 Mar 2019 12:59:27 +0000 (13:59 +0100)
These sessions most likely stem from a script / cronjob that is set-up
to regularly request the background queue to ensure it does not fill up
in periods of low user activity. They “fill up” the session table, skew
the user online statistics and are not going to be re-used.

wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php

index 5aeb04157e82b4312707f8416f34696e1fc17e02..f5f05c9db98f2a52fa36fc7df8ef9d17c7ae55a4 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\action;
 use wcf\system\background\BackgroundQueueHandler;
+use wcf\system\WCF;
 
 /**
  * Performs background queue jobs.
@@ -32,6 +33,9 @@ class BackgroundQueuePerformAction extends AbstractAction {
                        }
                }
                echo BackgroundQueueHandler::getInstance()->getRunnableCount();
+               if (WCF::getSession()->isFirstVisit() && !WCF::getUser()->userID) {
+                       WCF::getSession()->delete();
+               }
                exit;
        }
 }