vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r23218: LJSUP-14114: Remove outdated user sessio...

Committer: vad
LJSUP-14114: Remove outdated user session in background
U   trunk/bin/maint/clean_caches.pl
U   trunk/cgi-bin/LJ/Session.pm
Modified: trunk/bin/maint/clean_caches.pl
===================================================================
--- trunk/bin/maint/clean_caches.pl	2012-10-30 07:26:18 UTC (rev 23217)
+++ trunk/bin/maint/clean_caches.pl	2012-10-30 12:00:42 UTC (rev 23218)
@@ -184,6 +184,13 @@
     }
     print "    deleted $cnt_delete\n";
 
+    print "-I- Remove outdated sessions.\n";
+    LJ::disconnect_dbs();
+    foreach my $c (@LJ::CLUSTERS) {
+        my $dbh = LJ::get_cluster_master($c);
+        $dbh->do("DELETE FROM sessions WHERE timeexpire < UNIX_TIMESTAMP() LIMIT 50000");
+    }
+
     LJ::run_hooks('extra_cache_clean');
     LJ::disconnect_dbs();
 

Modified: trunk/cgi-bin/LJ/Session.pm
===================================================================
--- trunk/cgi-bin/LJ/Session.pm	2012-10-30 07:26:18 UTC (rev 23217)
+++ trunk/cgi-bin/LJ/Session.pm	2012-10-30 12:00:42 UTC (rev 23218)
@@ -105,11 +105,6 @@
     my $udbh = LJ::get_cluster_master($u);
     return undef unless $udbh;
 
-    # clean up any old, expired sessions they might have (lazy clean)
-    $u->do("DELETE FROM sessions WHERE userid=? AND timeexpire < UNIX_TIMESTAMP()",
-           undef, $u->{userid});
-    # FIXME: but this doesn't remove their memcached keys
-
     my $expsec     = LJ::Session->session_length($exptype);
     my $timeexpire = time() + $expsec;
 

Tags: livejournal, pl, pm, vad, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments