File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed
Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,9 @@ async def _init(self) -> None:
202202 self ._should_exit = anyio .Event ()
203203 self ._condition = anyio .Condition ()
204204 self ._event_send_stream , self ._event_receive_stream = (
205- anyio .create_memory_object_stream ()
205+ anyio .create_memory_object_stream (
206+ max_buffer_size = self .config .bot .event_queue_size
207+ )
206208 )
207209
208210 # 加载配置文件
Original file line number Diff line number Diff line change @@ -45,12 +45,14 @@ class BotConfig(ConfigModel):
4545 """Bot 配置。
4646
4747 Attributes:
48+ event_queue_size: 事件队列的最大缓冲区大小。
4849 plugins: 将被加载的插件列表,将被 `Bot` 类的 `load_plugins()` 方法加载。
4950 plugin_dirs: 将被加载的插件目录列表,将被 `Bot` 类的 `load_plugins_from_dirs()` 方法加载。
5051 adapters: 将被加载的适配器列表,将依次被 `Bot` 类的 `load_adapters()` 方法加载。
5152 log: AliceBot 日志相关设置。
5253 """
5354
55+ event_queue_size : int = Field (default = 0 , ge = 0 )
5456 plugins : set [str ] = Field (default_factory = set )
5557 plugin_dirs : set [DirectoryPath ] = Field (default_factory = set )
5658 adapters : set [str ] = Field (default_factory = set )
Original file line number Diff line number Diff line change 11{
22 "bot" : {
3+ "event_queue_size" : 0 ,
34 "plugins" : [],
45 "plugin_dirs" : [" plugins" ],
56 "adapters" : [],
You can’t perform that action at this time.
0 commit comments