utils

package
v3.4.7 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRetries     = 5
	InitialBackoff = 500 * time.Millisecond
	MaxBackoff     = 10 * time.Second
	BackoffFactor  = 2.0
)
View Source
const BalanceSyncLockPrefix = "lock:{transactions}:balance-sync:"
View Source
const BalanceSyncScheduleKey = "schedule:{transactions}:balance-sync"

Variables

View Source
var (
	BalanceSynced = metrics.Metric{
		Name:        "balance_synced",
		Unit:        "1",
		Description: "Measures the number of balances synced.",
	}
)

Functions

func BalanceInternalKey added in v3.3.6

func BalanceInternalKey(organizationID, ledgerID uuid.UUID, key string) string

BalanceInternalKey returns a key with the following format to be used on redis cluster: "balance:{contextName}:organizationID:ledgerID:key"

func FullJitter

func FullJitter(baseDelay time.Duration) time.Duration

FullJitter returns a random delay between [0, baseDelay], capped by MaxBackoff.

func GenericInternalKey added in v3.3.6

func GenericInternalKey(name, contextName, organizationID, ledgerID, key string) string

GenericInternalKey returns a key with the following format to be used on redis cluster: "name:{contextName}:organizationID:ledgerID:key"

func NextBackoff

func NextBackoff(current time.Duration) time.Duration

NextBackoff calculates the next exponential backoff, respecting the MaxBackoff capped.

func TransactionInternalKey added in v3.3.6

func TransactionInternalKey(organizationID, ledgerID uuid.UUID, key string) string

TransactionInternalKey returns a key with the following format to be used on redis cluster: "transaction:{contextName}:organizationID:ledgerID:key"

Types

This section is empty.

Jump to

Keyboard shortcuts

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