koishi-plugin-adapter-onebot-multi 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +8 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1723,8 +1723,13 @@ var LoadBalancer = class {
1723
1723
  }
1724
1724
  }
1725
1725
  if (assignments.length > 0) {
1726
- for (const { channelId, assignee } of assignments) {
1727
- this.lastAssignees.set(channelId, assignee);
1726
+ const batchSize = 100;
1727
+ for (let i = 0; i < assignments.length; i += batchSize) {
1728
+ const slice = assignments.slice(i, i + batchSize);
1729
+ await Promise.all(slice.map(async ({ channelId, assignee }) => {
1730
+ await this.ctx.database.setChannel("onebot", channelId, { assignee });
1731
+ this.lastAssignees.set(channelId, assignee);
1732
+ }));
1728
1733
  }
1729
1734
  }
1730
1735
  const botsWithData = onlineBots.filter((id) => {
@@ -2126,7 +2131,7 @@ var ConfigStore = class {
2126
2131
  var Config = import_koishi9.Schema.object({}).description("配置已迁移到 data/adapter-onebot-multi/config.yaml");
2127
2132
  var name = "adapter-onebot-multi";
2128
2133
  var inject = {
2129
- required: ["server"],
2134
+ required: ["server", "database"],
2130
2135
  optional: ["console"]
2131
2136
  };
2132
2137
  function apply(ctx, _config) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-adapter-onebot-multi",
3
3
  "description": "奶龙bot定制版onebot适配器,支持自动负载均衡与黑白名单,控制台侧边栏管理",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [