better scalability for token checks, RT#71513
[freeside.git] / FS / FS / cust_main / Billing_Realtime.pm
index c2cb2e3..0623fbb 100644 (file)
@@ -2718,6 +2718,7 @@ sub _token_check_next_recnum {
   my $sth = $dbh->prepare(
     'SELECT '.$tclass->primary_key.
     ' FROM '.$table.
+    " WHERE ( is_tokenized IS NULL OR is_tokenized = '' ) ".
     ' ORDER BY '.$tclass->primary_key.
     ' LIMIT '.$step.
     ' OFFSET '.$$offset