https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

--- Comment #11 from Henrik Krohns <apa...@hege.li> ---
Created attachment 5742
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5742&action=edit
Meta patch for trunk v1

Took too many days, but here's patch for a brute force approach.

Things done:

- Rules now keep track of when they are ready/done in $pms->{tests_already_hit}
(0 == done, but didn't hit). This is of obviously required feature for metas to
know when evaluating can be done.

- $pms->rule_pending() must be called from eval-rule function, if the result
can arrive later than when exiting the function.

- $pms->rule_done() need be called when above result has arrived. Note that if
a rule is waiting for multiple DNS queries, it is considered done when either
1) a positive hit from lookup 2) all queries are returned.   ($pms->rule_done()
does automatic check with has_pending_lookups() and ignores the call if there
are still pending queries)

- This might break backwards compatibility for third party async plugins, which
do not use above functions. In some cases metas using such rules might not hit
then. Still TODO to check if it's a problem and if it can be helped (maybe try
calling rule_pending() automatically from AsyncLoop, requires some kludging as
it's independent from PMS..)

- Check.pm do_meta_tests() basically runs at end of every priority and brute
force iterates through all non-finished metas, checking if their dependent
rules are ready. A final do_meta_tests() at scan end will also accept "lookup
pending" rules as ready (not sure yet if this is desired or not?)

- Duplicate rule merging code has been removed, since it would require new
bloaty extra logic to work with all the above. It saved very little resources
anyway, makes no difference.

Some 5% overall scan time penalty from the brute force meta iteration, probably
could be improved with some extra lookup tables. But that's without network
lookups, there might be some speed up too as metas now don't need to wait for
any pending lookups, they just evaluate when it's ready.

All tests run ok, testing on my live server..

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to