concurrency

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package concurrency provides utilities for enforcing a handler's concurrency preference.

See dogma.ConcurrencyPreference for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnforceConcurrencyPreference

func EnforceConcurrencyPreference(
	ctx context.Context,
	tx *sql.Tx,
	key *uuidpb.UUID,
	pref dogma.ConcurrencyPreference,
	fn func() error,
) (err error)

EnforceConcurrencyPreference calls fn, optionally serializing execution using a PostgreSQL session-level advisory lock when the concurrency preference is dogma.MinimizeConcurrency. If the preference is any other value, fn is called directly without acquiring a lock.

Session-level advisory locks are used (rather than transaction-level) so that the lock can be released before the transaction commits, minimizing the duration of serialization.

Types

This section is empty.

Jump to

Keyboard shortcuts

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