Draft
Conversation
📊 API Diff Results
|
jmank88
requested changes
Apr 30, 2026
Comment on lines
+14
to
+16
| // NewRelayer returns the active relayer for the plugin. Re-invoking NewRelayer | ||
| // replaces the previously served relayer; implementations must not retain | ||
| // background resources from old relayers outside the returned service. |
Contributor
There was a problem hiding this comment.
Why is it desirable to introduce this property? If NewRelayer is being called more than once, that is definitionally a bug that we should diagnose. If we want to also be defensive about enforcing the existing singleton property, then we could do that, but it's really most important to find the upstream root cause that allowed this to happen.
Also, we used to run multiple relayers instances inside of one plugin, in which case multiple calls were expected, and so a singleton or even single swappable instance is actually too restrictive and keying on chain ID would be more aligned.
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.
Summary
Adds server-side cleanup for replaced LOOP relayer resources, following the lifecycle issue described in PLEX-2873.
The LOOP host can refresh broker-backed connections and invoke NewRelayer again in a still-running plugin process. The server now tracks the currently served relayer resource and closes the previous served relayer once a replacement is successfully served. This makes the replacement contract explicit in the common relayer server instead of relying only on each plugin implementation to remember the lifecycle rule.
This PR also documents the PluginRelayer.NewRelayer contract: re-invocation replaces the active relayer, and implementations must not retain background resources from old relayers outside the returned service.
Validation
GOMODCACHE=/private/tmp/gomodcache GOCACHE=/private/tmp/gocache GOPATH=/private/tmp/gopath go test ./pkg/loop/internal/relayer -count=1
Notes
This complements the chainlink-aptos plugin-side fix, which closes the previous Aptos relayer/config emitter before constructing a replacement.