-
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
cache status get #1535
cache status get #1535
Conversation
ets = Keyword.fetch!(opts, :ets) | ||
:ok = event_bus.subscribe({:root_chain, "ethereum_new_height"}, link: true) | ||
state = ets | ||
{:ok, eth_block_number} = EthereumHeight.get() |
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.
Why the additional assignment here?
ets = Keyword.fetch!(opts, :ets) | |
:ok = event_bus.subscribe({:root_chain, "ethereum_new_height"}, link: true) | |
state = ets | |
{:ok, eth_block_number} = EthereumHeight.get() | |
state = Keyword.fetch!(opts, :ets) | |
:ok = event_bus.subscribe({:root_chain, "ethereum_new_height"}, link: true) | |
{:ok, eth_block_number} = EthereumHeight.get() |
defp key() do | ||
:status | ||
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.
defp key() do | |
:status | |
end | |
defp key(), do: :status |
contract_addr = contract_map_from_hex(contracts) | ||
|
||
mined_child_block_number = RootChain.get_mined_child_block() | ||
|
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.
why the newlines? Is this the formatter?
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.
formatter is ass
def events_bucket() do | ||
@events_bucket | ||
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.
def events_bucket() do | |
@events_bucket | |
end | |
def events_bucket(), do: @events_bucket |
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.
you're here for the free commits aren't you
''' | ||
Checks geth syncing status, errors are treated as not synced. | ||
Returns: | ||
* false - geth is synced | ||
* true - geth is still syncing. | ||
''' | ||
|
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.
''' | |
Checks geth syncing status, errors are treated as not synced. | |
Returns: | |
* false - geth is synced | |
* true - geth is still syncing. | |
''' | |
# Checks geth syncing status, errors are treated as not synced. | |
# Returns: | |
# * false - geth is synced | |
# * true - geth is still syncing. |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
defmodule OMG.Watcher.API.StatusCache 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.
Can we have a few tests to cover the new functions?
1ea35a6
to
9aabcb8
Compare
9aabcb8
to
b77df38
Compare
Protecting status.get from collapsing
Overview
Putting an ETS table in front of our internals.
Changes
Our underlying mechanisms can change state only on Ethereum block issuance interval (changes are in ethLogs). So pulling it more then once (for one client) per 15 seconds doesn't make any difference. But it buts lots of pressure on watchers internals.
Testing
mix test