mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix(proxy): build Redis spend-log rows as tuples and pin the LTRIM window in the pipeline test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9e53ee5f04
commit
65bf78b567
2 changed files with 3 additions and 3 deletions
|
|
@ -554,7 +554,7 @@ class RedisUpdateBuffer:
|
|||
try:
|
||||
buffer_size: Final = await self.redis_cache.async_rpush_and_trim(
|
||||
key=REDIS_SPEND_LOGS_BUFFER_KEY,
|
||||
values=[_encode_spend_log_row(row) for row in rows],
|
||||
values=tuple(_encode_spend_log_row(row) for row in rows),
|
||||
max_len=max_rows,
|
||||
)
|
||||
overflow: Final = buffer_size - max_rows
|
||||
|
|
@ -582,7 +582,7 @@ class RedisUpdateBuffer:
|
|||
)
|
||||
if popped is None:
|
||||
return ()
|
||||
encoded_rows: Final = popped if isinstance(popped, list) else [popped]
|
||||
encoded_rows: Final = tuple(popped) if isinstance(popped, list) else (popped,)
|
||||
decoded_rows: Final = (_decode_spend_log_row(encoded) for encoded in encoded_rows)
|
||||
return tuple(row for row in decoded_rows if row is not None)
|
||||
|
||||
|
|
|
|||
|
|
@ -1549,4 +1549,4 @@ async def test_async_rpush_and_trim_runs_push_and_trim_in_one_transaction(monkey
|
|||
client.pipeline.assert_called_once_with(transaction=True)
|
||||
assert pushed_len == 4
|
||||
assert rows == ["b", "c", "d"]
|
||||
assert [op[:2] for op in pipe.queued] == [("rpush", "ns:buf"), ("ltrim", "ns:buf")]
|
||||
assert pipe.queued == [("rpush", "ns:buf", "c", "d"), ("ltrim", "ns:buf", "-3", "-1")]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue