Cache eval-plugin glue methods for the process lifetime, not per message#34
Closed
bigio wants to merge 1 commit into
Closed
Cache eval-plugin glue methods for the process lifetime, not per message#34bigio wants to merge 1 commit into
bigio wants to merge 1 commit into
Conversation
PerMsgStatus::finish() undefined every register_plugin_eval_glue() generated wrapper sub (and any register_generated_rule_method() plugin subs) and cleared their tracking hash after every single message, even though this glue is 100% static per-config -- forcing a fresh eval() compile of every distinct eval-plugin function on every message instead of once per process, the same "compile once, reuse" pattern Check.pm already uses for its rule subs. It also contradicted register_generated_rule_method()'s documented contract, which says these methods are destroyed at Mail::SpamAssassin::finish() (session end), not per-message. Move the cleanup to Mail::SpamAssassin::finish(), alongside the existing finish_tests plugin-hook cleanup. Since that code runs outside the PerMsgStatus package, bare (non-fully-qualified) method names now need explicit qualification to avoid undefining the wrong symbol. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Good catch. +1 I think we could refactor the code so the glue functions aren't necessary at all. But that would be a separate PR. This PR is still needed to cleanup @TEMPORARY_METHODS that are registered by register_generated_rule_method. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PerMsgStatus::finish() undefined every register_plugin_eval_glue() generated wrapper sub (and any register_generated_rule_method() plugin subs) and cleared their tracking hash after every single message, even though this glue is 100% static per-config -- forcing a fresh eval() compile of every distinct eval-plugin function on every message instead of once per process, the same "compile once, reuse" pattern Check.pm already uses for its rule subs.
It also contradicted register_generated_rule_method()'s documented contract, which says these methods are destroyed at Mail::SpamAssassin::finish() (session end), not per-message.
Move the cleanup to Mail::SpamAssassin::finish(), alongside the existing finish_tests plugin-hook cleanup. Since that code runs outside the PerMsgStatus package, bare (non-fully-qualified) method names now need explicit qualification to avoid undefining the wrong symbol.