IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27604


Ignore:
Timestamp:
Apr 5, 2010, 1:21:44 PM (16 years ago)
Author:
bills
Message:

drop database connection while doing the deletes because they
are really slow and if lots of jobs are outstanding we can run out of database connections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/magic_destreak_cleanup.pl

    r27396 r27604  
    118118
    119119my $num_components = 0;
     120my @components;
     121# save the data, so we can disconnect from the database
     122# deleting can take awhile
    120123while (my $comp = $stmt2->fetchrow_hashref()) {
     124        push @components, $comp;
    121125        $num_components++;
    122 
     126}
     127
     128$stmt2->finish();
     129$dbh->disconnect() or warn $dbh->errstr;
     130
     131my $dynamicMasks;               # Use dynamic masks?
     132foreach my $comp (@components) {
    123133        my $component = $comp->{component};
    124134        my $backup_path_base = $comp->{backup_path_base};
     
    129139        if ($stage eq "chip") {
    130140            # Check to see if we're using dynamic masks
    131             my $dynamicMasks;               # Use dynamic masks?
    132             {
     141            if (!defined $dynamicMasks) {
    133142                # Get the PSASTRO recipe
    134143                my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -";
     
    228237}
    229238
     239$dbh = DBI->connect($dsn, $dbuser, $dbpassword) or die "Cannot connect to mysql server\n";
     240
    230241if (!$no_update and ($num_components > 0)) {
    231242    my $result = $dbh->do("DELETE FROM magicDSFile WHERE magic_ds_id = ?", undef, $magic_ds_id);
Note: See TracChangeset for help on using the changeset viewer.