Configuration
You can pass an optional configuration object as the second argument to EdgeWorker.start()
to tweak the worker’s behavior.
Default configuration
Queue and polling
queueName
Type: string
Default: 'tasks'
The name of the PGMQ queue to listen to for messages.
maxPollSeconds
Type: number
Default: 5
Amount of seconds to wait for a message to be available in the queue.
pollIntervalMs
Type: number
Default: 200
The interval for in-database polling that pgmq.read_with_poll
does.
Most of the time, you don’t need to change this value.
Retries
retryDelay
Type: number
Default: 5
Amount of seconds to wait between retry attempts.
retryLimit
Type: number
Default: 5
Maximum number of retry attempts for failed message processing before marking the message as dead.
Set to 0
to disable retries.
visibilityTimeout
Type: number
Default: 3
The duration in seconds that a message is hidden from other consumers while being processed.
Concurrency
maxConcurrent
Type: number
Default: 10
This option limits concurrency - the maximum number of messages that can be processed at the same time. Increase for IO-heavy tasks (network or db calls), decrease for CPU-heavy tasks.
maxPgConnections
Type: number
Default: 4
This option limits the number of connections to the database. Increase for IO-heavy tasks (network or db calls), decrease for CPU-heavy tasks.