Merge pull request #272 from flashbots/healthcheck-retry
Retry on healthcheck
This commit is contained in:
commit
af7ae2c3b0
10
listener.py
10
listener.py
@ -2,8 +2,8 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import aiohttp
|
|
||||||
import dramatiq
|
import dramatiq
|
||||||
|
from aiohttp_retry import ExponentialRetry, RetryClient
|
||||||
|
|
||||||
from mev_inspect.block import get_latest_block_number
|
from mev_inspect.block import get_latest_block_number
|
||||||
from mev_inspect.concurrency import coro
|
from mev_inspect.concurrency import coro
|
||||||
@ -110,8 +110,12 @@ async def inspect_next_block(
|
|||||||
|
|
||||||
|
|
||||||
async def ping_healthcheck_url(url):
|
async def ping_healthcheck_url(url):
|
||||||
async with aiohttp.ClientSession() as session:
|
retry_options = ExponentialRetry(attempts=3)
|
||||||
async with session.get(url):
|
|
||||||
|
async with RetryClient(
|
||||||
|
raise_for_status=False, retry_options=retry_options
|
||||||
|
) as client:
|
||||||
|
async with client.get(url) as _response:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
17
poetry.lock
generated
17
poetry.lock
generated
@ -18,6 +18,17 @@ yarl = ">=1.0,<2.0"
|
|||||||
[package.extras]
|
[package.extras]
|
||||||
speedups = ["aiodns", "brotli", "cchardet"]
|
speedups = ["aiodns", "brotli", "cchardet"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aiohttp-retry"
|
||||||
|
version = "2.4.6"
|
||||||
|
description = "Simple retry client for aiohttp"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
aiohttp = "*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aiosignal"
|
name = "aiosignal"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@ -1181,7 +1192,7 @@ multidict = ">=4.0"
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.9"
|
python-versions = "^3.9"
|
||||||
content-hash = "063e246b07155c7bbc227ffd8a0d237d402a3eb00a804dbb389b67b7a0e35354"
|
content-hash = "a96cd942b973a1d8214788d968ab3fda29e1bf470030524207529c06194b2f70"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
aiohttp = [
|
aiohttp = [
|
||||||
@ -1258,6 +1269,10 @@ aiohttp = [
|
|||||||
{file = "aiohttp-3.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:3c5e9981e449d54308c6824f172ec8ab63eb9c5f922920970249efee83f7e919"},
|
{file = "aiohttp-3.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:3c5e9981e449d54308c6824f172ec8ab63eb9c5f922920970249efee83f7e919"},
|
||||||
{file = "aiohttp-3.8.0.tar.gz", hash = "sha256:d3b19d8d183bcfd68b25beebab8dc3308282fe2ca3d6ea3cb4cd101b3c279f8d"},
|
{file = "aiohttp-3.8.0.tar.gz", hash = "sha256:d3b19d8d183bcfd68b25beebab8dc3308282fe2ca3d6ea3cb4cd101b3c279f8d"},
|
||||||
]
|
]
|
||||||
|
aiohttp-retry = [
|
||||||
|
{file = "aiohttp_retry-2.4.6-py3-none-any.whl", hash = "sha256:4c478be0f54a0e1bbe8ee3128122ff42c26ed2e1e16c13ca601a087004ec8bb7"},
|
||||||
|
{file = "aiohttp_retry-2.4.6.tar.gz", hash = "sha256:288c1a0d93b4b3ad92910c56a0326c6b055c7e1345027b26f173ac18594a97da"},
|
||||||
|
]
|
||||||
aiosignal = [
|
aiosignal = [
|
||||||
{file = "aiosignal-1.2.0-py3-none-any.whl", hash = "sha256:26e62109036cd181df6e6ad646f91f0dcfd05fe16d0cb924138ff2ab75d64e3a"},
|
{file = "aiosignal-1.2.0-py3-none-any.whl", hash = "sha256:26e62109036cd181df6e6ad646f91f0dcfd05fe16d0cb924138ff2ab75d64e3a"},
|
||||||
{file = "aiosignal-1.2.0.tar.gz", hash = "sha256:78ed67db6c7b7ced4f98e495e572106d5c432a93e1ddd1bf475e1dc05f5b7df2"},
|
{file = "aiosignal-1.2.0.tar.gz", hash = "sha256:78ed67db6c7b7ced4f98e495e572106d5c432a93e1ddd1bf475e1dc05f5b7df2"},
|
||||||
|
@ -15,6 +15,7 @@ aiohttp = "^3.8.0"
|
|||||||
dramatiq = {extras = ["redis"], version = "^1.12.1"}
|
dramatiq = {extras = ["redis"], version = "^1.12.1"}
|
||||||
pycoingecko = "^2.2.0"
|
pycoingecko = "^2.2.0"
|
||||||
boto3 = "^1.20.48"
|
boto3 = "^1.20.48"
|
||||||
|
aiohttp-retry = "^2.4.6"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pre-commit = "^2.13.0"
|
pre-commit = "^2.13.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user