From 571814c080cf9d43c5efb04cac390a3e8687286c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 25 Oct 2025 09:44:44 -0500 Subject: [PATCH] Remove Redis dependency from RateLimiterWrapper - Always use ETS-based RateLimiter instead of checking for REDIS_URL - Remove RedisRateLimiter calls that were causing crashes - Simplify wrapper to only delegate to Aprsme.RateLimiter --- CLAUDE.md | 6 ++++- lib/aprsme/rate_limiter_wrapper.ex | 36 +++++++++--------------------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index e69400a..703132f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,4 +61,8 @@ This is a web application written using the Phoenix web framework. - Use `Task.async_stream(collection, callback, options)` for concurrent enumeration with back-pressure. The majority of times you will want to pass `timeout: :infinity` as option - **Always run mix format after changing any Elixir files** -[... rest of the file remains unchanged ...] \ No newline at end of file +## Git Commit Guidelines + +- **Never** add "Co-Authored-By: Claude" or similar AI co-authorship tags to commits +- Commits should appear as authored solely by the user (Graham) +- Keep commit messages clear and concise, describing what changed and why \ No newline at end of file diff --git a/lib/aprsme/rate_limiter_wrapper.ex b/lib/aprsme/rate_limiter_wrapper.ex index 11e1230..b123898 100644 --- a/lib/aprsme/rate_limiter_wrapper.ex +++ b/lib/aprsme/rate_limiter_wrapper.ex @@ -1,46 +1,30 @@ defmodule Aprsme.RateLimiterWrapper do @moduledoc """ - Wrapper that provides the same API for both Hammer and RedisRateLimiter + Wrapper that provides the same API using ETS-based rate limiter """ @doc """ Check rate limit - compatible with Hammer.hit/3 API """ def hit(bucket, scale_ms, limit) do - if using_redis?() do - Aprsme.RedisRateLimiter.check_rate(bucket, limit, scale_ms) - else - Aprsme.RateLimiter.hit(bucket, scale_ms, limit) - end + Aprsme.RateLimiter.hit(bucket, scale_ms, limit) end @doc """ Reset rate limit for a bucket """ - def reset(bucket) do - if using_redis?() do - Aprsme.RedisRateLimiter.reset(bucket) - else - # Hammer doesn't provide a reset function - # Best we can do is return ok - :ok - end + def reset(_bucket) do + # ETS-based rate limiter doesn't provide a reset function + # Return ok + :ok end @doc """ Get current count for a bucket """ - def count(bucket, scale_ms) do - if using_redis?() do - Aprsme.RedisRateLimiter.count(bucket, scale_ms) - else - # Hammer doesn't provide a count function - # Return 0 as default - {:ok, 0} - end - end - - defp using_redis? do - System.get_env("REDIS_URL") != nil + def count(_bucket, _scale_ms) do + # ETS-based rate limiter doesn't provide a count function + # Return 0 as default + {:ok, 0} end end