diff options
author | Yorhel <git@yorhel.nl> | 2009-09-25 18:56:34 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-09-25 18:56:34 +0200 |
commit | ce6687f3766fdeca78cad90d3e461ed889ed37d6 (patch) | |
tree | 5be6afd605d93803d238162fe44671b218be98cc /lib/Multi | |
parent | 9ba57996ed6d7fe3dd0d0c1fe5e1b3827b8a2b8a (diff) |
Multi::Maintenance: Check for and remove unused relation graphs daily
And updated some comments while I was at it
Diffstat (limited to 'lib/Multi')
-rw-r--r-- | lib/Multi/Maintenance.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm index e29c7b52..423def75 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 tagcache vnpopularity + vncache tagcache vnpopularity cleangraphs usercache statscache revcache logrotate |], ], heap => { - daily => [qw|vncache tagcache vnpopularity|], + daily => [qw|vncache tagcache vnpopularity cleangraphs|], monthly => [qw|usercache statscache revcache logrotate|], @_, }, @@ -99,24 +99,30 @@ sub log_stats { # num, res, action, time sub vncache { - # this takes about 30s to complete. We really need to search for an alternative + # this takes about 40s to complete. We really need to search for an alternative # method of keeping the c_* columns in the vn table up-to-date. $_[KERNEL]->post(pg => do => 'SELECT update_vncache(0)', undef, 'log_stats', 'vncache'); } sub tagcache { - # this still takes "only" about 3 seconds max. Let's hope that doesn't increase too much. + # takes about 18 seconds max. ouch, but still kind-of acceptable $_[KERNEL]->post(pg => do => 'SELECT tag_vn_calc()', undef, 'log_stats', 'tagcache'); } sub vnpopularity { - # still takes at most 2 seconds. Againt, let's hope that doesn't increase... + # still takes at most 2 seconds. let's hope that doesn't increase... $_[KERNEL]->post(pg => do => 'SELECT update_vnpopularity()', undef, 'log_stats', 'vnpopularity'); } +sub cleangraphs { + # should be pretty fast + $_[KERNEL]->post(pg => do => 'DELETE FROM vn_graphs vg WHERE NOT EXISTS(SELECT 1 FROM vn WHERE rgraph = vg.id)', + undef, 'log_stats', 'cleangraphs'); +} + # # M O N T H L Y J O B S |