Skip to content

Commit

Permalink
refactor(worker): rename maxConcurrency to maxConcurrent
Browse files Browse the repository at this point in the history
Update Worker configuration parameter name across multiple files to improve naming consistency.
This includes changes in Worker.ts, index.ts, and README.md to reflect the new parameter name.

Fixes naming inconsistency in worker configuration
  • Loading branch information
jumski committed Jan 9, 2025
1 parent 767db00 commit a231e58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkgs/supaworker/src/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface WorkerConfig {
maxPollSeconds?: number;
pollIntervalMs?: number;
maxPgConnections?: number;
maxConcurrency?: number;
maxConcurrent?: number;
}

export class Worker<MessagePayload extends Json> {
Expand All @@ -47,7 +47,7 @@ export class Worker<MessagePayload extends Json> {
maxPollSeconds: config.maxPollSeconds ?? 5,
pollIntervalMs: config.pollIntervalMs ?? 100,
maxPgConnections: config.maxPgConnections ?? 4,
maxConcurrency: config.maxConcurrency ?? 50,
maxConcurrent: config.maxConcurrency ?? 50,
};

this.sql = postgres(this.config.connectionString, {
Expand All @@ -59,7 +59,7 @@ export class Worker<MessagePayload extends Json> {
this.executionController = new ExecutionController(
this.queue,
this.mainController.signal,
this.config.maxConcurrency
this.config.maxConcurrent
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { delay } from 'jsr:@std/async';

const sleep1s = () => delay(1000);

Supaworker.start(sleep1s, { maxConcurrency: 1 });
Supaworker.start(sleep1s, { maxConcurrent: 1 });
2 changes: 1 addition & 1 deletion pkgs/supaworker/tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ functions/

✅ Concurrency

- [ ] Worker respects maxConcurrency (does not read new messages if there are no empty slots, reads max empty-slots-count of messages)
- [ ] Worker respects maxConcurrent (does not read new messages if there are no empty slots, reads max empty-slots-count of messages)

0 comments on commit a231e58

Please sign in to comment.