summaryrefslogtreecommitdiff
path: root/lib/Multi
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-01-26 20:18:47 +0100
committerYorhel <git@yorhel.nl>2010-01-26 20:18:47 +0100
commit2bda6076a93e45c259148f0723fff37cd5aa56dc (patch)
treeafcbcf5968e53c64415c8aef80515b71cdc00783 /lib/Multi
parentf82550b1cef9e91780b43e61c60c61af1ba139fd (diff)
Automatically remove sessions that haven't been used for a month
Diffstat (limited to 'lib/Multi')
-rw-r--r--lib/Multi/Maintenance.pm11
1 files changed, 9 insertions, 2 deletions
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
#