Files
zeekay 7d727874d5 chore: rebrand Formance Payments -> Hanzo Payments (hanzo-fi)
- go.mod module path + all self-imports: github.com/formancehq/payments -> github.com/hanzo-fi/payments
  (1590 .go files / 3152 refs; 20 modules: root, pkg/client, pkg/domain, 18 ce/plugins).
  External dep kept: formancehq/go-libs.
- plugins: each ce/plugins/* consumed a *published* pkg/domain; added local
  'replace .../pkg/domain => ../../../pkg/domain' (consistent with root) so every
  standalone plugin module builds in-monorepo. compile-plugin.sh MOD var rebranded too.
- branding: README, LICENSE (dual MIT+EE; upstream copyright retained + Hanzo added),
  goreleaser (release images -> registry.hanzo.ai/hanzo-fi, OCI labels, homepage),
  proto go_package, renovate, speakeasy gen.yaml, connector-template *.gotpl.
- CI: removed Numary/Formance workflows + composite action; added canonical hanzo.yml +
  cicd.yml (hanzoai/ci, gated HANZO_CI_ENABLED) + secretless ci.yml (go build/vet).
- kept as data/compat keys: wire capability enums ALLOW_FORMANCE_*, generated SDK type
  client.Formance, domain field FormanceRedirectURL, OTEL_SERVICE_NAME, upstream base image.
- verified: go build ./... (default + -tags ee) + all 20 nested modules green.
2026-07-05 13:08:55 -07:00
..

Continuous Payment Worker

This is a small Go program that continuously inserts rows into the public.payments table. It is intended to be run ad-hoc (outside the main application) to generate write load during migrations or operational testing.

Build

go build ./tools/continuous-writer

Run

Environment variables (flags override env):

  • PG_DSN: Postgres DSN (default: postgres://payments:payments@localhost:5432/payments?sslmode=disable)
  • INTERVAL_MS: Delay between inserts per worker in milliseconds (default: 1000)
  • WORKERS: Number of concurrent workers (default: 5)
  • BATCH_SIZE: Number of rows per INSERT (default: 500)
  • FLUSH_MS: Max time to wait before flushing a partial batch in milliseconds (default: 10000)
  • ASSET: Asset string (default: USD/2)
  • SCHEME: Scheme string (default: test)
  • TYPE: payin|payout|transfer (default: payin)
  • CONFIG_ENCRYPTION_KEY: Database encryption key to encrypt connector config (default: mysuperencryptionkey)

Notes on connector handling:

  • The worker will ensure a connector row exists in public.connectors with a generated ID (provider: qonto) and set an example encrypted config using CONFIG_ENCRYPTION_KEY. It logs warnings if this upsert or encryption update fails.

Examples:

PG_DSN=postgres://payments:payments@localhost:5432/payments?sslmode=disable
INTERVAL_MS=50 WORKERS=4 BATCH_SIZE=200
ASSET=USD/2 SCHEME=test TYPE=payin
go run ./tools/continuous-writer

Or with flags:

go run ./tools/continuous-writer
-dsn "postgres://payments:payments@localhost:5432/payments?sslmode=disable"
-workers 4 -interval-ms 50 -type payout
-batch-size 200 -scheme test -asset USD/2 -encryption-key mysuperencryptionkey

Notes

  • The program handles SIGINT/SIGTERM and will shut down gracefully.
  • It uses the minimal set of required columns for public.payments based on the current schema.
  • Adjust DSN to match your docker-compose Postgres (see docker-compose.yml).
  • Batching: rows are accumulated per worker and flushed either when BATCH_SIZE is reached or after FLUSH_MS, whichever comes first.
  • Logging includes batch insert counts and connector ensure logs.