mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-27 01:22:18 +00:00
test(proxy): restore pipeline methods on expiring Redis fake after merge
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
14cb7c65c2
commit
b415f2263a
1 changed files with 10 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import asyncio
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Mapping
|
||||
from collections.abc import Mapping, Sequence
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
|
@ -11,6 +11,7 @@ from fastapi import HTTPException
|
|||
|
||||
import litellm
|
||||
from litellm.caching.dual_cache import DualCache
|
||||
from litellm.types.caching import RedisPipelineIncrementOperation
|
||||
from litellm.constants import STREAM_SSE_KEEPALIVE_PING_BYTES
|
||||
from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import (
|
||||
AgenticAnthropicStreamingIterator,
|
||||
|
|
@ -2400,6 +2401,14 @@ class _ExpiringRedisCache:
|
|||
self.expires_at[key] = time.monotonic() + (ttl if ttl is not None else self.default_ttl)
|
||||
return True
|
||||
|
||||
async def async_increment_pipeline(
|
||||
self, increment_list: Sequence[RedisPipelineIncrementOperation], **kwargs: object
|
||||
) -> list[float]:
|
||||
return [await self.async_increment(op["key"], op["increment_value"]) for op in increment_list]
|
||||
|
||||
def get_ttl(self, **kwargs: object) -> int | None:
|
||||
return int(self.default_ttl)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_reservation_survives_redis_counter_ttl_while_request_in_flight(
|
||||
|
|
@ -2475,15 +2484,6 @@ async def test_reservation_lease_stops_when_request_task_ends_without_reconcilin
|
|||
assert redis_cache.refresh_count == 0
|
||||
assert await redis_cache.async_get_cache(key=counter_key) is None
|
||||
|
||||
async def async_increment_pipeline(self, increment_list, **kwargs):
|
||||
results = []
|
||||
for op in increment_list:
|
||||
results.append(await self.async_increment(op["key"], op["increment_value"]))
|
||||
return results
|
||||
|
||||
def get_ttl(self, **kwargs) -> None:
|
||||
return None
|
||||
|
||||
|
||||
class _TeamMembershipFloorDb:
|
||||
"""Stands in for `prisma_client.db`: only the team-membership row exists and its spend is the DB floor."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue