-
Notifications
You must be signed in to change notification settings - Fork 40
refactor: remove GenServer behavior from gossip blobsidecar #1115
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 comment about error handling. The rest is fine.
@spec join_topics() :: :ok | ||
def join_topics() do | ||
topics() | ||
|> Enum.each(fn topic_name -> Libp2pPort.join_topic(self(), topic_name) end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not use each
if it can return an error and leave the node in an unusable state. We should be able to return an error here, for example, with a reduce, or with a map and then counting the errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with small comment
Libp2pPort.subscribe_to_topic(topic, __MODULE__) | ||
|> case do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid the pipe for a single operation.
case Libp2pPort.subscribe_to_topic(topic, __MODULE__) do
:ok -> ...
{:error, reason} -> ...
end
This PR removes all the GenServer behavior from the gossip BlobSideCar.
Closes #1114