Update the code to work on current trunk.

Changes for 941469 conflicted with this fix, so this had to be updated.
This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-07-14 23:31:05 -03:00
4 changed files with 909 additions and 30 deletions

View File

@@ -75,6 +75,7 @@ sub new {
last_poll => 0,
active_cxn => {}, # keyed off ID
event_cache => [],
_reasons_for_matching => {},
};
return bless $self, $class;
}
@@ -475,7 +476,15 @@ sub find {
PTDEBUG && _d("Query isn't running long enough");
next QUERY;
}
PTDEBUG && _d('Exceeds busy time');
my $reason = 'Exceeds busy time';
PTDEBUG && _d($reason);
# Saving the reasons for each query in the objct is a bit nasty,
# but the alternatives are worse:
# - Saving internal data in the query
# - Instead of using the stringified hashref as a key, using
# a checksum of the hashes' contents. Which could occasionally
# fail miserably due to timing-related issues.
push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
$matched++;
}
@@ -486,7 +495,9 @@ sub find {
PTDEBUG && _d("Query isn't idle long enough");
next QUERY;
}
PTDEBUG && _d('Exceeds idle time');
my $reason = 'Exceeds idle time';
PTDEBUG && _d($reason);
push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
$matched++;
}
@@ -507,7 +518,9 @@ sub find {
PTDEBUG && _d('Query does not match', $property, 'spec');
next QUERY;
}
PTDEBUG && _d('Query matches', $property, 'spec');
my $reason = 'Query matches ' . $property . ' spec';
PTDEBUG && _d($reason);
push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
$matched++;
}
}