Commit 51fff06
authored
fix: enforce min trigger size=1 to prevent immediate exports
When max_queue_size is small (e.g., 1), max_queue_size * export_trigger_ratio could be less than 1, resulting in a zero trigger size.
This would cause immediate exports after adding any item to the queue (since queue_size >= 0 is always true), defeating the purpose of batching.
This change ensures the trigger size is at least 1 by using max(1, int(max_queue_size * export_trigger_ratio)).
**Fix**:
```python
# Before (broken for small queues)
trigger_size = int(max_queue_size * export_trigger_ratio)
# After (fixed: min 1 item needed)
trigger_size = max(1, int(max_queue_size * export_trigger_ratio))
```
**Key change**:
Added `max(1, ...)` to guarantee the trigger size is **never 0**, so batching works even for tiny queues.1 parent 7e632c2 commit 51fff06
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
0 commit comments