Skip to content

Commit b0cd6bc

Browse files
authored
Increase default visibilityTimeout for queue based Edge Worker (#112)
* chore: update visibilityTimeout default to 10 seconds across code and documentation - Changed default visibilityTimeout from 3 to 10 in EdgeWorker configuration, queue, and createQueueWorker - Updated related documentation to reflect the new default value of 10 seconds - Ensures consistent timeout behavior and clearer documentation for users * fix: update default visibilityTimeout to 10s for queue-based worker - Added changeset file indicating patches for @pgflow/edge-worker and @pgflow/website - Updated default visibilityTimeout value to 10 seconds for queue-based worker
1 parent 68dcaa2 commit b0cd6bc

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

.changeset/khaki-papers-fix.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@pgflow/edge-worker': patch
3+
'@pgflow/website': patch
4+
---
5+
6+
Update visibilityTimeout default value to 10s for queue-based worker

pkgs/edge-worker/src/EdgeWorker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class EdgeWorker {
134134
*
135135
* // how long a job is invisible after reading
136136
* // if not successful, will reappear after this time
137-
* visibilityTimeout: 3,
137+
* visibilityTimeout: 10,
138138
* });
139139
* ```
140140
*/
@@ -157,7 +157,7 @@ export class EdgeWorker {
157157
pollIntervalMs: config.pollIntervalMs ?? 200,
158158
retryDelay: config.retryDelay ?? 5,
159159
retryLimit: config.retryLimit ?? 5,
160-
visibilityTimeout: config.visibilityTimeout ?? 3,
160+
visibilityTimeout: config.visibilityTimeout ?? 10,
161161
connectionString:
162162
config.connectionString || this.platform.getConnectionString(),
163163
};

pkgs/edge-worker/src/queue/Queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class Queue<TPayload extends Json> {
7070

7171
async readWithPoll(
7272
batchSize = 20,
73-
visibilityTimeout = 2,
73+
visibilityTimeout = 10,
7474
maxPollSeconds = 5,
7575
pollIntervalMs = 200
7676
) {

pkgs/edge-worker/src/queue/createQueueWorker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export type QueueWorkerConfig = {
6666
/**
6767
* How long a job is invisible after reading in seconds.
6868
* If not successful, will reappear after this time.
69-
* @default 3
69+
* @default 10
7070
*/
7171
visibilityTimeout?: number;
7272

@@ -145,7 +145,7 @@ export function createQueueWorker<TPayload extends Json>(
145145
batchSize: config.batchSize || config.maxConcurrent || 10,
146146
maxPollSeconds: config.maxPollSeconds || 5,
147147
pollIntervalMs: config.pollIntervalMs || 200,
148-
visibilityTimeout: config.visibilityTimeout || 3,
148+
visibilityTimeout: config.visibilityTimeout || 10,
149149
},
150150
createLogger('ReadWithPollPoller')
151151
);

pkgs/website/src/content/docs/edge-worker/getting-started/configuration.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ EdgeWorker.start(handler, {
5555

5656
// how long a job is invisible after reading
5757
// if not successful, will reappear after this time
58-
visibilityTimeout: 3,
58+
visibilityTimeout: 10,
5959
});
6060
```
6161

@@ -82,7 +82,7 @@ EdgeWorker.start(handler, {
8282

8383
### `visibilityTimeout`
8484
**Type:** `number`
85-
**Default:** `3`
85+
**Default:** `10`
8686

8787
The duration (in seconds) that a message remains invisible to other consumers while being processed.
8888

0 commit comments

Comments
 (0)