Skip to content

cleanup: restrict broadcast channels to the output component#557

Merged
Molter73 merged 1 commit intomainfrom
mauro/cleanup/pipeline-components
Apr 27, 2026
Merged

cleanup: restrict broadcast channels to the output component#557
Molter73 merged 1 commit intomainfrom
mauro/cleanup/pipeline-components

Conversation

@Molter73
Copy link
Copy Markdown
Contributor

@Molter73 Molter73 commented Apr 27, 2026

Description

This is a small cleanup regarding the usage of broadcast channels.

Currently the RateLimiter implementation is using this type of channel to receive events from HostScanner and forward them to the output component. Since there are not other tasks involved, a mpsc channel can be used without wrapping the event being passed in an Arc, this should somewhat reduce contention since the Arc will not have its reference changed when passing between components. More importantly, we have discussed in the past moving most of the code away from tokio and use regular threads instead, since our workload is CPU bound, the std library does not have a broadcast channel but it does have mpsc, so this should make the change easier in the future.

Finally, this makes it clear the flow of events is linear and only diverges when multiple outputs need to be used in parallel.

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

CI should be enough, behavior should not be modified.

This is a small cleanup regarding the usage of broadcast channels.

Currently the RateLimiter implementation is using this type of channel
to receive events from HostScanner and forward them to the output
component. Since there are not other tasks involved, a mpsc channel can
be used without wrapping the event being passed in an Arc, this should
somewhat reduce contention since the Arc will not have its reference
changed when passing between components. More importantly, we have
discussed in the past moving most of the code away from tokio and use
regular threads instead, since our workload is CPU bound, the std
library does not have a broadcast channel but it does have mpsc, so this
should make the change easier in the future.

Finally, this makes it clear the flow of events is linear and only
diverges when multiple outputs need to be used in parallel.
@Molter73 Molter73 requested a review from a team as a code owner April 27, 2026 13:23
@Molter73 Molter73 merged commit ea8751f into main Apr 27, 2026
51 of 65 checks passed
@Molter73 Molter73 deleted the mauro/cleanup/pipeline-components branch April 27, 2026 15:17
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