Permalink
Browse files

tweak queue_end and the like

  • Loading branch information...
1 parent a317fe1 commit 9a1391f3134f69fac740e176c9a25c01b145a3f2 @lestrrat lestrrat committed Jul 31, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/STF/Worker/Loop/Q4M.pm
@@ -74,10 +74,10 @@ sub work {
$setsig->();
my $default = POSIX::SigAction->new('DEFAULT');
- while ( $self->should_loop ) {
- $sth = $dbh->prepare(<<EOSQL);
- SELECT args FROM $table WHERE queue_wait('$waitcond', 60)
+ $sth = $dbh->prepare(<<EOSQL);
+ SELECT args FROM $table WHERE queue_wait('$waitcond', 60)
EOSQL
+ while ( $self->should_loop ) {
$self->incr_processed();
my $rv = $sth->execute();
$sth->bind_columns( \$object_id );
@@ -93,7 +93,6 @@ EOSQL
debugf("---- END %s:%s ----", $table, $row_id) if STF_DEBUG;
} );
}
- eval { $dbh->do("SELECT queue_end()") };
my $sig_guard = Scope::Guard->new(\&$setsig);
@@ -109,8 +108,8 @@ EOSQL
Time::HiRes::usleep( $interval );
}
}
+ eval { $dbh->do("SELECT queue_end()") };
}
- eval { $dbh->do("SELECT queue_end()") };
infof("Process %d exiting... (%s)", $$, $impl);
}

0 comments on commit 9a1391f

Please sign in to comment.