Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- 'src/**'
- 'tests/**'
- 'examples/**'
- 'pyproject.toml'
- 'uv.lock'
- '.github/workflows/ci.yml'
Expand All @@ -14,6 +15,7 @@ on:
paths:
- 'src/**'
- 'tests/**'
- 'examples/**'
- 'pyproject.toml'
- 'uv.lock'
- '.github/workflows/ci.yml'
Expand Down
5 changes: 3 additions & 2 deletions examples/full/redis_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import os
import time
import uuid
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any

Expand Down Expand Up @@ -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
Expand Down
Loading