Unique jobs
Inserts the same account sync twice with UniqueOpts{ByArgFields: ["account_id"], ByPeriod: time.Hour}. The second insert returns the first job. Account ids above 2^53 that differ in the last digit stay distinct.
Run
docker compose -f deploy/docker-compose.yml up -d --wait postgres
go run ./examples/unique
The example connects to FOREMAN_DATABASE_URL (default
postgres://foreman:foreman@localhost:55432/foreman?sslmode=disable) and recreates its own schema
on every run.
Expected output
second insert: duplicate skipped: true (job 1)
another account: duplicate skipped: false