projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ce27e05
)
speed up service search
author
Mark Wells
<mark@freeside.biz>
Fri, 5 Apr 2013 19:13:45 +0000
(12:13 -0700)
committer
Mark Wells
<mark@freeside.biz>
Fri, 5 Apr 2013 19:14:23 +0000
(12:14 -0700)
FS/FS/svc_hardware.pm
patch
|
blob
|
history
diff --git
a/FS/FS/svc_hardware.pm
b/FS/FS/svc_hardware.pm
index
96502e4
..
b28cc9e
100644
(file)
--- a/
FS/FS/svc_hardware.pm
+++ b/
FS/FS/svc_hardware.pm
@@
-105,9
+105,13
@@
sub search_sql {
my ($class, $string) = @_;
my @where = ();
my ($class, $string) = @_;
my @where = ();
- my $ip = NetAddr::IP->new($string);
- if ( $ip ) {
- push @where, $class->search_sql_field('ip_addr', $ip->addr);
+ if ( $string =~ /^[\d\.:]+$/ ) {
+ # if the string isn't an IP address, this will waste several seconds
+ # attempting a DNS lookup. so try to filter those out.
+ my $ip = NetAddr::IP->new($string);
+ if ( $ip ) {
+ push @where, $class->search_sql_field('ip_addr', $ip->addr);
+ }
}
if ( $string =~ /^(\w+)$/ ) {
}
if ( $string =~ /^(\w+)$/ ) {