Skip to content

Conversation

@tzaffi
Copy link
Contributor

@tzaffi tzaffi commented May 7, 2023

Summary

Proposing that when Register() is called twice for the same plugin name, it will panic.
An alternative would involve changing the signature to return an error.

Explanation

This is mostly about familiarizing myself with the Conduit repo. This is not an urgent issue.

As I was playing around with conduit plugin templates I realized there is a slight issue with plugin registration.

It's possible to register a plugin with the same name as another, and overwrite the first registration

The current functionality keeps a map from a user provided name to the actual plugin. If a plugin with the same name as another is registed a second time, it simply overwrites the first. This certainly isn't a pressing concern as we have complete control over what to register and what not to.

Test Plan

CI

@codecov
Copy link

codecov bot commented May 7, 2023

Codecov Report

Merging #72 (5ec7257) into master (442791a) will increase coverage by 0.92%.
The diff coverage is 73.86%.

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   67.66%   68.58%   +0.92%     
==========================================
  Files          32       36       +4     
  Lines        1976     2394     +418     
==========================================
+ Hits         1337     1642     +305     
- Misses        570      660      +90     
- Partials       69       92      +23     
Impacted Files Coverage Δ
conduit/data/block_export_data.go 100.00% <ø> (+92.30%) ⬆️
conduit/plugins/importers/algod/metrics.go 100.00% <ø> (ø)
pkg/cli/internal/list/list.go 20.75% <ø> (ø)
...lugins/exporters/postgresql/postgresql_exporter.go 66.66% <51.21%> (-11.54%) ⬇️
pkg/cli/cli.go 65.97% <65.97%> (ø)
conduit/pipeline/pipeline.go 66.09% <72.10%> (+0.64%) ⬆️
conduit/data/config.go 76.47% <76.47%> (ø)
conduit/plugins/importers/algod/algod_importer.go 84.69% <88.29%> (-3.62%) ⬇️
conduit/pipeline/errors.go 100.00% <100.00%> (ø)
conduit/plugins/exporters/exporter_factory.go 100.00% <100.00%> (ø)
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@tzaffi tzaffi marked this pull request as ready for review May 8, 2023 03:08
@winder
Copy link
Contributor

winder commented May 8, 2023

Good idea, nice catch.

@winder winder merged commit dd2865a into algorand:master May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants