-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase code readability/clarity #212
Comments
The
This code is basically trying too hard. The
|
The code uses a Using a Don't forget that a pointer in any garbage-collected language isn't just a pointer. It's a handle, and the thing it points to can change due to the As always, profiling will tell you if this is a performance improvement. But it almost certainly will be. |
Another optimization around channels to consider: Use a
If you need additional information around a message, like maybe expiry, then just pass a
This also allows caduceus to drop messages without expending the compute to decode messages, since decoding is delayed to the point at which the message is handled. A slight disadvantage with this approach is that caduceus can receive invalid messages which will be enqueued. This is easily mitigated with judicious limits on the |
@johnabass per your first comment (#212 (comment)), the more complex form is needed to load a new channel if it has changed: Line 468 in 76e8eab
Without the for-select, we can't load something new when we are cut off. If we changed it to the traditional for-range, how could we still do this? |
caduceus/outboundSender.go
Line 455 in 76e8eab
I added comments to the dispatcher() function and the outbound sender in general, but overall the outbound sender is not very easy to understand. If possible, we should figure out if there's a way to maintain performance while also improving readability.
The text was updated successfully, but these errors were encountered: