IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29292


Ignore:
Timestamp:
Oct 1, 2010, 9:08:32 AM (16 years ago)
Author:
rhenders
Message:

Added automatic cleanup (and optimize) at midnight every day

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czarpoll.pl

    r29252 r29292  
    105105    my $newState = undef;
    106106    my $nsStatus = undef;
     107    my $lastDay = strftime('%Y-%m-%d', localtime);
     108    my $today = undef;
    107109
    108110    while (1) {
    109111
     112        # check whether day has changed. if so, cleanup tables from previous day and optimize
     113        $today = strftime('%Y-%m-%d', localtime);
     114        if ($czarDb->isBefore($lastDay, $today)) {
     115       
     116                print "* New day - performing cleanup\n";
     117                $czarDb->cleanupDateRange($lastDay, $lastDay, "30 MINUTE");
     118                $czarDb->optimize();
     119                $lastDay = $today;
     120        }
     121
    110122        # sort out times
    111         $begin =  strftime('%Y-%m-%d 06:35',localtime);
     123        $begin = strftime('%Y-%m-%d 06:35',localtime);
    112124        $end = $czarDb->getNowTimestamp();
    113125
Note: See TracChangeset for help on using the changeset viewer.