@workglow/ai 0.2.26 → 0.2.28

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/dist/browser.js CHANGED
@@ -348,7 +348,7 @@ import {
348
348
  JobQueueClient,
349
349
  JobQueueServer
350
350
  } from "@workglow/job-queue";
351
- import { InMemoryQueueStorage } from "@workglow/storage";
351
+ import { InMemoryQueueStorage } from "@workglow/job-queue";
352
352
  import { getTaskQueueRegistry, TaskConfigurationError } from "@workglow/task-graph";
353
353
  class QueuedExecutionStrategy {
354
354
  queueName;
@@ -417,18 +417,16 @@ class QueuedExecutionStrategy {
417
417
  }
418
418
  }
419
419
  async acquireLimiterSlot(limiter, signal) {
420
- const poll = async () => {
421
- while (!await limiter.canProceed()) {
422
- if (signal.aborted) {
423
- throw signal.reason ?? new AbortSignalJobError2("The operation was aborted");
424
- }
425
- const next = await limiter.getNextAvailableTime();
426
- const delay = Math.max(0, next.getTime() - Date.now());
427
- await new Promise((resolve) => setTimeout(resolve, Math.min(delay, 50)));
420
+ let token = await limiter.tryAcquire();
421
+ while (token === null || token === undefined) {
422
+ if (signal.aborted) {
423
+ throw signal.reason ?? new AbortSignalJobError2("The operation was aborted");
428
424
  }
429
- };
430
- await poll();
431
- await limiter.recordJobStart();
425
+ const next = await limiter.getNextAvailableTime();
426
+ const delay = Math.max(0, next.getTime() - Date.now());
427
+ await new Promise((resolve) => setTimeout(resolve, Math.min(delay, 50)));
428
+ token = await limiter.tryAcquire();
429
+ }
432
430
  }
433
431
  ensureQueue() {
434
432
  if (!this.initPromise) {
@@ -7446,4 +7444,4 @@ export {
7446
7444
  AiChatInputSchema
7447
7445
  };
7448
7446
 
7449
- //# debugId=3021428467E8785264756E2164756E21
7447
+ //# debugId=D9E399F9E044625464756E2164756E21