mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
fix(accounting): batch durable usage on a five-second interval
This commit is contained in:
parent
b368c432d0
commit
f5bb72f391
2 changed files with 2 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ class UsageCaptureSettings(BaseModel):
|
|||
model_config = ConfigDict(frozen=True, extra="forbid")
|
||||
|
||||
batch_size: int = Field(default=1000, ge=2, le=1000)
|
||||
flush_interval_seconds: float = Field(default=0.2, gt=0, le=10)
|
||||
flush_interval_seconds: float = Field(default=5.0, gt=0, le=10)
|
||||
max_pending_bytes: int = Field(default=16 * 1024 * 1024, ge=1024)
|
||||
max_pending_records: int = Field(default=10000, ge=2)
|
||||
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ async def test_elapsed_flush_deadline_commits_a_partial_batch() -> None:
|
|||
database.release.set()
|
||||
|
||||
async def expired_flush(wakeup: asyncio.Event, timeout: float) -> None:
|
||||
assert timeout == 5.0
|
||||
await _wait_for_batch(wakeup, 0)
|
||||
|
||||
meter: Final = DurableUsageMeter(database.write, UsageCaptureSettings(batch_size=10), wait_for_batch=expired_flush)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue