Skip to content

Commit

Permalink
Fix redis unix url in limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsasha committed Aug 22, 2023
1 parent 83568b7 commit 9c2ba0a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion irrd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Note that version is also in pyproject.toml
__version__ = "4.4-dev"
__version__ = "4.4.0b1"
ENV_MAIN_PROCESS_PID = "IRRD_MAIN_PROCESS_PID"
META_KEY_HTTP_CLIENT_IP = "HTTP-Client-IP"
7 changes: 6 additions & 1 deletion irrd/server/http/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ async def startup():
try:
app.state.database_handler = DatabaseHandler(readonly=True)
app.state.preloader = Preloader(enable_queries=True)
async_redis_prefix = ""
if get_setting("redis_url").startswith("redis://"):
async_redis_prefix = "async+"
elif get_setting("redis_url").startswith("unix://"):
async_redis_prefix = "async+redis+"
app.state.rate_limiter_storage = limits.storage.storage_from_string(
"async+" + get_setting("redis_url"),
async_redis_prefix + get_setting("redis_url"),
protocol_version=2,
)
app.state.rate_limiter = limits.aio.strategies.MovingWindowRateLimiter(app.state.rate_limiter_storage)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "irrd"
[tool.poetry]
name = "irrd"
# Note that version is also in irrd/__init__.py
version = "4.4-dev"
version = "4.4.0b1"
description = "Internet Routing Registry daemon (IRRd)"
authors = ["Reliably Coded for NTT Ltd. and others <[email protected]>"]
license = "BSD"
Expand Down

0 comments on commit 9c2ba0a

Please sign in to comment.