Skip to content
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

Add websocket new head subscriptions that fall back to polling on error #11

Open
rupurt opened this issue Mar 17, 2021 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@rupurt
Copy link
Contributor

rupurt commented Mar 17, 2021

Given a blockchain adapter
When it receives N websocket disconnections for new head subscriptions in a period P
Then it should try the alternate websocket RPC providers or fallback to polling according to the configured strategy

The venue configuration DSL will need an additional option

config :slurp,
  blockchains: %{
    "ethereum-mainnet" => %{
      start_on_boot: false,
      name: "Ethereum Mainnet",
      adapter: Slurp.Adapters.Evm,
      network_id: 1,
      chain_id: 1,
      chain: "ETH",
      testnet: false,
      timeout: 5000,
      new_head_initial_history: 128,
      poll_interval_ms: 2_500,
      rpc: [
        "wss://main-light.eth.linkpool.io/ws"
      ]
      # Select strategy websocket connection disconnect
      websocket_fallback_strategy: {Slurp.RpcStrategies.WebsocketFallback, :next, [[count: 5, per: 1, unit: :minute]]},
    }
  }
@rupurt rupurt added the enhancement New feature or request label Mar 17, 2021
@rupurt
Copy link
Contributor Author

rupurt commented Mar 17, 2021

@AwaitFuture ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant