-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: broadcast in-memory blocks #809
Conversation
defp push_hash(%__MODULE__{dispatched_hashes: dispatched_hashes}, type_hash) do | ||
queue = :queue.in(type_hash, dispatched_hashes) | ||
|
||
if length(:queue.to_list(queue)) > @max_hashes_size 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.
Could you increase this number please? The counting I am doing is 10 generations (max of sync Server
), 20 microblocks and more than 50 transactions each.
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.
Or maybe use some kind of TTL to remove the older ones.
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.
Moved to ETS for the TTL expiring. thanks!
@subs_target_channels :subs_target_channels | ||
|
||
@spec start_link(any()) :: GenServer.on_start() | ||
def start_link(_arg), do: GenServer.start_link(__MODULE__, :ok, name: __MODULE__) | ||
|
||
@impl GenServer | ||
def init(:ok) do | ||
{:ok, @no_state} | ||
EtsCache.new(@hashes_table, @expiration_minutes) |
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.
One last thing, I would move the creation of this named ETS to outside the GenServer init in case it restarts.
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.
Done
This state check will avoid sending the same mb/kb multiple times, which happens when re-syncing in-memory gens.
refs #808