diff options
| author | fukachan <fukachan> | 2004-08-13 13:24:54 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-08-13 13:24:54 +0000 |
| commit | b1bba02f89b28e52a15602ba9e2b4ad4bd8e1fe4 (patch) | |
| tree | 1ba0c77ba68fd50c3b65f67d326b16d8358a4106 /fml/lib/FML/Process | |
| parent | 5150d3e6ee7e529e789ad644db34cdb136f7d54a (diff) | |
| download | fml8-b1bba02f89b28e52a15602ba9e2b4ad4bd8e1fe4.tar.gz fml8-b1bba02f89b28e52a15602ba9e2b4ad4bd8e1fe4.tar.bz2 fml8-b1bba02f89b28e52a15602ba9e2b4ad4bd8e1fe4.zip | |
change cleanup() logic:
get all queue id list and remove too old invalid queue.
Diffstat (limited to 'fml/lib/FML/Process')
| -rw-r--r-- | fml/lib/FML/Process/QueueManager.pm | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/fml/lib/FML/Process/QueueManager.pm b/fml/lib/FML/Process/QueueManager.pm index 77d8da6f..a79e1791 100644 --- a/fml/lib/FML/Process/QueueManager.pm +++ b/fml/lib/FML/Process/QueueManager.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: QueueManager.pm,v 1.21 2004/07/23 13:01:29 fukachan Exp $ +# $FML: QueueManager.pm,v 1.22 2004/08/13 11:48:23 fukachan Exp $ # package FML::Process::QueueManager; @@ -163,20 +163,24 @@ sub cleanup my $queue_dir = $self->{ _directory }; use Mail::Delivery::Queue; - my $queue = new Mail::Delivery::Queue { directory => $queue_dir }; - my $classes = $queue->get_class_list() || []; # new, incoming, ... - - for my $class (@$classes) { - my $ra = $queue->list($class); - for my $qid (@$ra) { - my $q = new Mail::Delivery::Queue { - id => $qid, - directory => $queue_dir, - }; - - unless ( $q->is_valid_queue() ) { + my $queue = new Mail::Delivery::Queue { directory => $queue_dir }; + my $list = $queue->list_all() || []; + my $limit = 5 * 24 * 3600; # 5 days. + my $now = time; + + for my $qid (@$list) { + my $q = new Mail::Delivery::Queue { + id => $qid, + directory => $queue_dir, + }; + + unless ( $q->is_valid_queue() ) { + my $mtime = $q->last_modified_time(); + + # enough old. + if ($mtime < $now - $limit) { $curproc->log("qmgr: remove invalid queue qid=$qid"); - # $q->remove(); + $q->remove(); } } } |
