mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-13 06:00:58 +00:00
feat: message aggregator (#1985)
* feat: aggregator
* fix: resolve deadlock, mutation, and safety issues in message aggregator
- Fix deadlock: don't await cancelled timer tasks inside the lock;
_flush_buffer acquires the same lock, causing a deadlock cycle
- Fix message_event mutation: keep original message_event unmodified
to preserve message_id/metadata for reply/quote; only pass merged
message_chain separately
- Fix Plain positional arg: Plain('\n') → Plain(text='\n')
- Fix float() ValueError: wrap delay cast in try/except
- Add MAX_BUFFER_MESSAGES (10) cap to prevent unbounded buffer growth
- Default enabled to false to avoid surprising latency on upgrade
- Fix flush_all: cancel all timers under one lock acquisition, then
flush outside the lock to avoid deadlock
---------
Co-authored-by: RockChinQ <rockchinq@gmail.com>
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
"prefix": [],
|
||||
"regexp": []
|
||||
},
|
||||
"message-aggregation": {
|
||||
"enabled": false,
|
||||
"delay": 1.5
|
||||
},
|
||||
"misc": {
|
||||
"combine-quote-message": true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user