-
Notifications
You must be signed in to change notification settings - Fork 59
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
async stream + timeout #1593
async stream + timeout #1593
Conversation
put_timestamp_and_sft(exit_event, state.min_exit_period_seconds, state.child_block_interval) | ||
end, | ||
timeout: 50_000, | ||
on_timeout: :kill_task, |
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.
are we sure we don't want to exit the process?
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.
okay, and I refresh the page and is changed to exit 😅
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.
no :) you were 32seconds too quick
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.
🔥
end, | ||
timeout: 50_000, | ||
on_timeout: :exit, | ||
max_concurrency: System.schedulers_online() * 2 |
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.
this would not be larger then our rate limit to infura right (is there a rate limit)? (btw, I actually have no idea what both number are 😅)
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.
the beam installs a scheduler per CPU core. so if you have 8 cores times 2, you'd do at most 16 exits at the same time.
@@ -175,7 +175,7 @@ defmodule OMG.Watcher.ExitProcessor do | |||
but under unchanged conditions, it should have unchanged behavior from POV of an outside caller. | |||
""" | |||
def check_validity() do | |||
GenServer.call(__MODULE__, :check_validity) | |||
GenServer.call(__MODULE__, :check_validity, 60_000) |
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.
Can you add this value to module attribute and reuse it?
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.
yeah!
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! Also a smart plan to merge to master so we can observe the async stream behaviour for a bit longer
fn exit_event -> | ||
put_timestamp_and_sft(exit_event, state.min_exit_period_seconds, state.child_block_interval) | ||
end, | ||
timeout: 50_000, |
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.
Oh this Task.async_stream
's :timeout
is very handy 👏
Enum.map( | ||
events, | ||
events | ||
|> Task.async_stream( |
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.
ExPlasma.InFlightExit.txbytes_to_id(txbytes)
is already a local computation though, no longer making RPC calls.
Maybe at least we can remove the custom timeout and so defaults back to 5000ms which is plenty enough?
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.
oh geez. I didn't even check. Now I remember you did this!
📋 Add associated issues, tickets, docs URL here.
Overview
Describe what your Pull Request is about in a few sentences.
Changes
Describe your changes and implementation choices. More details make PRs easier to review.
Testing
Describe how to test your new feature/bug fix and if possible, a step by step guide on how to demo this.