Skip to content

Commit

Permalink
Retry on healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevs committed Feb 16, 2022
1 parent 4b93f95 commit eda0485
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 7 additions & 3 deletions listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import logging
import os

import aiohttp
import dramatiq
from aiohttp_retry import ExponentialRetry, RetryClient

from mev_inspect.block import get_latest_block_number
from mev_inspect.concurrency import coro
Expand Down Expand Up @@ -110,8 +110,12 @@ async def inspect_next_block(


async def ping_healthcheck_url(url):
async with aiohttp.ClientSession() as session:
async with session.get(url):
retry_options = ExponentialRetry(attempts=3)

async with RetryClient(
raise_for_status=False, retry_options=retry_options
) as client:
async with client.get(url) as _response:
pass


Expand Down
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ aiohttp = "^3.8.0"
dramatiq = {extras = ["redis"], version = "^1.12.1"}
pycoingecko = "^2.2.0"
boto3 = "^1.20.48"
aiohttp-retry = "^2.4.6"

[tool.poetry.dev-dependencies]
pre-commit = "^2.13.0"
Expand Down

0 comments on commit eda0485

Please sign in to comment.