On Sat, May 07, 2022 at 07:41:00PM +0200, Michael Storz wrote:
> Hi Henrik,
> 
> you added a rule_ready to OneLineBodyRuleType.pm
> 
> +    $sub .= '
> +      $self->rule_ready(q{'.$rulename.'});
> +    ';
> +
> 
> Why? I thought OneLineBodyRuleType.pm does not have asynchronous calls? And
> if rule_ready is used, should'n there be a call to rule_pending first?
> 
> A similar case exists with Reuse.pm: call of rule_ready, no call of
> rule_pending.

I think what you are missing is that _any_ rule must be internally declared
as run when it's finished, for the meta pending check to work.  This is
tracked by $pms->{tests_already_hit}->{$rulename} existing or not existing.

In Check.pm, you can see these in several places:

    if ($scoresptr->{q{'.$rulename.'}}) {
      $hitsptr->{q{'.$rulename.'}} ||= 0;
      ...then it does it's checks and maybe calls got_hit()

So the hitsptr forces $pms->{tests_already_hit}->{$rulename} exist - and
when it exists, do_meta_tests() knows it's ready.

I'm not exactly sure why I used $self->rule_ready(q{'.$rulename.'}); in
OneLineBodyRuleType.pm instead of the more direct $hitsptr->{q{'.$rulename.'}} 
||= 0;
... rule_ready() is marginally more expensive call, so changing 
tests_already_hit directly
is safe when we know rule has nothing to do with DNS.

Hopefully this clears up things?

Cheers,
Henrik

Reply via email to