@yaebal/runner 0.0.1 → 0.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaebal/runner",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "yaebal runner — concurrent update processing with per-chat sequentialization.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -16,7 +16,7 @@
16
16
  "src"
17
17
  ],
18
18
  "dependencies": {
19
- "@yaebal/types": "0.0.1"
19
+ "@yaebal/types": "0.0.2"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "latest"
package/src/index.test.ts CHANGED
@@ -139,7 +139,7 @@ test("run: processes a batch, keeps per-chat order, advances offset, drains on s
139
139
 
140
140
  await tick();
141
141
  await tick();
142
-
142
+
143
143
  await handle.stop();
144
144
 
145
145
  assert.ok(order.includes(1) && order.includes(2) && order.includes(3));
package/src/index.ts CHANGED
@@ -181,7 +181,7 @@ export function run(bot: RunnerBot, options: RunnerOptions = {}): RunnerHandle {
181
181
  while (!stopped) {
182
182
  if (scheduler.size() >= concurrency) await scheduler.whenBelow(concurrency);
183
183
  if (stopped) break;
184
-
184
+
185
185
  let updates: Update[];
186
186
  try {
187
187
  updates = await bot.api.getUpdates({
@@ -192,13 +192,13 @@ export function run(bot: RunnerBot, options: RunnerOptions = {}): RunnerHandle {
192
192
  });
193
193
  } catch (error) {
194
194
  if (stopped) break;
195
-
195
+
196
196
  options.onError?.(error);
197
197
  await delay(3000);
198
-
198
+
199
199
  continue;
200
200
  }
201
-
201
+
202
202
  for (const update of updates) {
203
203
  offset = update.update_id + 1;
204
204
  scheduler.submit(seqBy(update), () => safe(update));