diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ee73a7..9951ab1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: paths: - 'src/**' - 'tests/**' + - 'examples/**' - 'pyproject.toml' - 'uv.lock' - '.github/workflows/ci.yml' @@ -14,6 +15,7 @@ on: paths: - 'src/**' - 'tests/**' + - 'examples/**' - 'pyproject.toml' - 'uv.lock' - '.github/workflows/ci.yml' diff --git a/examples/full/redis_store.py b/examples/full/redis_store.py index a8be3f6..7bae922 100644 --- a/examples/full/redis_store.py +++ b/examples/full/redis_store.py @@ -33,6 +33,7 @@ import os import time +import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Any @@ -251,8 +252,8 @@ async def increment(self, key: str, window: str) -> int: # Remove expired entries pipe.zremrangebyscore(redis_key, 0, window_start) # Add current request with timestamp as score - # Use timestamp + microseconds to ensure uniqueness - pipe.zadd(redis_key, {f"{now}": now}) + # Add a unique suffix so requests with the same timestamp aren't merged + pipe.zadd(redis_key, {f"{now}-{uuid.uuid4().hex}": now}) # Set TTL to auto-expire the key pipe.expire(redis_key, window_duration + 60) # Extra buffer # Get the count