[rt-users] Help With Script performance
Bryon Baker
bbaker at copesan.com
Wed Jun 8 14:54:21 EDT 2016
Using the following script I will on occasion get "Deep recursion on anonymous subroutine". I am one not sure what this means and two I do not have any idea how to fix it.
Looking for some ideas from the experts. Thanks.
sub Commit
{
my $self = shift;
my $ticket = $self->TicketObj;
my $datecreated = $ticket->CreatedObj->Unix;
my $datestarted = $ticket->Started;
my ($styyyy, $stmm, $stdd, $sthh, $stmn, $stss) = $datestarted =~ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/;
my $dateresolved;
my $timeworded;
my $isodateresolved;
my $transactions = $ticket->Transactions;
$transactions->Limit( FIELD => 'Type', VALUE => 'Status', FIELD => 'NewValue', VALUE => 'closed');
# $transactions->Limit( FIELD => 'Type', VALUE => 'EmailRecord' );
while (my $transaction = $transactions->Next)
{
#print "Found Transaction\n";
if (defined $transaction->CreatedObj->Unix)
{
$isodateresolved = $transaction->CreatedObj->ISO;
my ($yyyy, $mm, $dd, $hh, $mn, $ss) = $isodateresolved =~ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/;
my ($defdays, $defhours, $defminutes, $defseconds) =
Delta_DHMS($styyyy, $stmm, $stdd, $sthh, $stmn, $stss,
$yyyy, $mm, $dd, $hh, $mn, $ss); # later
my $timeworded = ($defdays * 24 * 60) + ($defhours * 60) + $defminutes;
if ($timeworded < 1)
{
$timeworded = 1;
}
$ticket->SetResolved($isodateresolved);
$ticket->SetTimeWorked($timeworded);
$RT::Logger->debug("Update Resolved on Closed Ticket script Complete for ticket " . $ticket->Id . "\n");
}
}
return 1;
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 Ext. 2296 * 262-783-6261 Ext. 2296
bbaker at copesan.com
www.copesan.com
"Servicing North America with Local Care"
More information about the rt-users
mailing list