@workglow/job-queue 0.0.84 → 0.0.86

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/README.md +12 -4
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -505,10 +505,14 @@ const limiter = new DelayLimiter(500);
505
505
  ### Rate Limiter
506
506
 
507
507
  ```typescript
508
- import { InMemoryRateLimiter } from "@workglow/job-queue";
508
+ import { RateLimiter } from "@workglow/job-queue";
509
+ import { InMemoryRateLimiterStorage } from "@workglow/storage";
510
+
511
+ // Create storage for the rate limiter
512
+ const rateLimiterStorage = new InMemoryRateLimiterStorage();
509
513
 
510
514
  // Max 10 executions per 60-second window
511
- const limiter = new InMemoryRateLimiter({
515
+ const limiter = new RateLimiter(rateLimiterStorage, "my-queue", {
512
516
  maxExecutions: 10,
513
517
  windowSizeInSeconds: 60,
514
518
  initialBackoffDelay: 1000,
@@ -520,13 +524,17 @@ const limiter = new InMemoryRateLimiter({
520
524
  ### Composite Limiter
521
525
 
522
526
  ```typescript
523
- import { CompositeLimiter, ConcurrencyLimiter, DelayLimiter } from "@workglow/job-queue";
527
+ import { CompositeLimiter, ConcurrencyLimiter, DelayLimiter, RateLimiter } from "@workglow/job-queue";
528
+ import { InMemoryRateLimiterStorage } from "@workglow/storage";
529
+
530
+ // Create storage for the rate limiter
531
+ const rateLimiterStorage = new InMemoryRateLimiterStorage();
524
532
 
525
533
  // Combine multiple limiting strategies
526
534
  const limiter = new CompositeLimiter([
527
535
  new ConcurrencyLimiter(3),
528
536
  new DelayLimiter(100),
529
- new InMemoryRateLimiter({
537
+ new RateLimiter(rateLimiterStorage, "my-queue", {
530
538
  maxExecutions: 20,
531
539
  windowSizeInSeconds: 60,
532
540
  }),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workglow/job-queue",
3
3
  "type": "module",
4
- "version": "0.0.84",
4
+ "version": "0.0.86",
5
5
  "description": "Job queue management for Workglow, handling task scheduling, execution, and distributed processing.",
6
6
  "scripts": {
7
7
  "watch": "concurrently -c 'auto' 'bun:watch-*'",
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "peerDependencies": {
32
- "@workglow/storage": "0.0.84",
33
- "@workglow/util": "0.0.84"
32
+ "@workglow/storage": "0.0.86",
33
+ "@workglow/util": "0.0.86"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@workglow/storage": {
@@ -41,8 +41,8 @@
41
41
  }
42
42
  },
43
43
  "devDependencies": {
44
- "@workglow/storage": "0.0.84",
45
- "@workglow/util": "0.0.84"
44
+ "@workglow/storage": "0.0.86",
45
+ "@workglow/util": "0.0.86"
46
46
  },
47
47
  "files": [
48
48
  "dist"