postgres

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

README

Postgres Backend

Connection pool

NewPostgresOptions starts the pgx pool with 16 connections (DefaultMaxConns). This is a starting point for the default worker parallelism; set options.PgOptions.MaxConns explicitly for the deployment's worker count and PostgreSQL connection budget.

Testing

Database-backed tests are skipped unless POSTGRES_ENABLED=true; unit tests still run. Use only an isolated, disposable database: durability and stress tests truncate tables, and migration tests drop/recreate tables. Never point these tests at production.

The backend package tests honor PGHOST (default 127.0.0.1), PGPORT (5432), PGDATABASE (durabletask), PGUSER (postgres), and PGPASSWORD (postgres). Run them with POSTGRES_ENABLED=true go test -count=1 ./backend/postgres. Chaos tests additionally require STRIX_TEST_POSTGRES_CHAOS=1 and their isolated Docker Compose configuration; both manual CI workflows set the database opt-in explicitly.

Documentation

Index

Constants

View Source
const DefaultMaxConns int32 = 16

DefaultMaxConns is the initial PostgreSQL pool size. Increase it to match the expected worker concurrency and the database connection budget.

Variables

This section is empty.

Functions

func NewPostgresBackend

func NewPostgresBackend(opts *PostgresOptions, logger backend.Logger) backend.Backend

NewPostgresBackend creates a new postgres-based Backend object.

Types

type PostgresOptions

type PostgresOptions struct {
	PgOptions           *pgxpool.Config
	WorkflowLockTimeout time.Duration
	ActivityLockTimeout time.Duration
}

func NewPostgresOptions

func NewPostgresOptions(host string, port uint16, database string, user string, password string) *PostgresOptions

NewPostgresOptions creates a new options object for the postgres backend provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL