mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
test_async_log_success_event_increments_by_actual_tokens
This commit is contained in:
parent
5b17fa2d82
commit
5620cfea6e
1 changed files with 7 additions and 0 deletions
|
|
@ -65,6 +65,13 @@ for i = 1, #KEYS, 2 do
|
|||
table.insert(results, increment_value) -- counter
|
||||
else
|
||||
local counter = redis.call('INCR', counter_key)
|
||||
-- FIX: Set TTL if counter key was just created (has no TTL)
|
||||
-- This happens when window_key exists but counter_key doesn't (e.g., tokens key
|
||||
-- created after requests key when both share the same window_key)
|
||||
local current_ttl = redis.call('TTL', counter_key)
|
||||
if current_ttl == -1 then
|
||||
redis.call('EXPIRE', counter_key, window_size)
|
||||
end
|
||||
table.insert(results, window_start) -- window_start
|
||||
table.insert(results, counter) -- counter
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue