Skip to content

Commit 8e89592

Browse files
committed
test: add all unit test cases
1 parent acf9702 commit 8e89592

11 files changed

+5648
-8
lines changed

core/llm_token_ratelimit/metric_logger.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func (ml *MetricLogger) Record(item MetricItem) {
258258

259259
ml.buffer = append(ml.buffer, item)
260260

261-
if len(ml.buffer) >= ml.bufferSize {
261+
if len(ml.buffer) > ml.bufferSize {
262262
ml.flushUnsafe()
263263
}
264264
}
@@ -326,8 +326,9 @@ func (ml *MetricLogger) Stop() {
326326
ml.mu.Lock()
327327
defer ml.mu.Unlock()
328328

329+
ml.flushUnsafe()
330+
329331
if ml.writer != nil {
330-
ml.writer.Flush()
331332
ml.writer = nil
332333
}
333334

0 commit comments

Comments
 (0)