You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should also consider adding the Receiver trait; otherwise, the senders are not coupled to the tokio broadcast implementation, but the listeners are.
The original reason to add the Sender trait was not to decouple the implementation from the tokio broadcast channel, but to be able to mock the sender in tests. Anyway, it would be good to have both advantages:
Mock the Receiver
Decouple the receiver from the tokio broadcast implementation, so we can replace it in the future with other channel libraries.
Perhaps we can simply add the trait to enable mocking when needed and leave the coupling to the broadcast channel for now. It's not an enormous debt since we only have three listeners now.
Activity
josecelano commentedon Apr 25, 2025
We should also consider adding the
Receivertrait; otherwise, the senders are not coupled to the tokio broadcast implementation, but the listeners are.The original reason to add the
Sendertrait was not to decouple the implementation from the tokio broadcast channel, but to be able to mock the sender in tests. Anyway, it would be good to have both advantages:Receivercc @da2ce7
josecelano commentedon Apr 25, 2025
I've just realised the
Senderis also coupled to tokio broadcast channels because of the error type:SendErroristokio::sync::broadcast::error.Perhaps we can simply add the trait to enable mocking when needed and leave the coupling to the broadcast channel for now. It's not an enormous debt since we only have three listeners now.
Merge #1479: Overhaul stats: Extract events package (part 1)
fet: [torrust#1480] new events pacakge
feat: [torrust#1480] add event sender trait
feat: [torrust#1480] add event sender based on tokio broadcast channel
feat: [torrust#1480] add generic EventBus to events package
refactor: [torrust#1480] use the new events crate in http-tracker-cor…
refactor: [torrust#1480] use the new events crate in http-tracker-cor…
refactor: [torrust#1480] use the new events crate in udp-tracker-core…
refactor: [torrust#1480] use the new events crate in udp-tracker-serv…
Merge #1483: Overhaul stats: Extract events package (part 2)