From 2bda6076a93e45c259148f0723fff37cd5aa56dc Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 26 Jan 2010 20:18:47 +0100 Subject: Automatically remove sessions that haven't been used for a month --- ChangeLog | 2 +- lib/Multi/Maintenance.pm | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2b21f11..5b13dae1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,7 +10,7 @@ git - ? - Only tagmods can create top-level tags - Notification system (still only used for PMs) - Removed the ?l10n= paremeter - - Keep track of when a session has last been used + - Remove sessions that haven't been used for more than a month 2.10 - 2010-01-10 - VN score on tag pages use plain averages instead of bayesian rating diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm index 864239dd..be267aba 100644 --- a/lib/Multi/Maintenance.pm +++ b/lib/Multi/Maintenance.pm @@ -17,12 +17,12 @@ sub spawn { package_states => [ $p => [qw| _start shutdown set_daily daily set_monthly monthly log_stats - vncache_inc tagcache vnpopularity vnrating cleangraphs + vncache_inc tagcache vnpopularity vnrating cleangraphs cleansessions vncache_full usercache statscache logrotate |], ], heap => { - daily => [qw|vncache_inc tagcache vnpopularity vnrating cleangraphs|], + daily => [qw|vncache_inc tagcache vnpopularity vnrating cleangraphs cleansessions|], monthly => [qw|vncache_full usercache statscache logrotate|], @_, }, @@ -151,6 +151,13 @@ sub cleangraphs { } +sub cleansessions { + $_[KERNEL]->post(pg => do => + q|DELETE FROM sessions WHERE lastused < NOW()-'1 month'::interval|, + undef, 'log_stats', 'cleansessions'); +} + + # # M O N T H L Y J O B S # -- cgit v1.2.3