treewide: update to new multi worker dowork api
The work.Queue() implementation has changed and now allows scheduling
tasks from multiple goroutines in parallel. Also, it requires a new
argument for limiting the queue buffer size in order to apply back
pressure.
Define new configuration variables to allow tuning the queue sizes and
number of workers per service:
[mail]
# Maximum size of the outgoing email queue (default 512).
egress-queue-size = 512
[$service_name]
# Number of parallel workers per queue (default 1).
# There are multiple queues (for egress email, webhooks, etc.).
# This setting is applied on a per-queue basis.
queue-workers = 1
[webhooks]
# Maximum size of the webhooks queue (default 512).
queue-size = 512
Use these new settings to configure the queues and workers accordingly.
Fix unit tests as well.
Link: https://git.sr.ht/~sircmpwn/dowork/commit/95719cfc0118
Signed-off-by: Robin Jarry <robin@jarry.cc>
webhooks: fix failing test
database.WithTx: rollback if func returns error
Previously, this only rolled back if the called function panicked. This
updates it to also roll back if the called function returns an error.
webhooks/legacy_test: verify headers are recorded
webhooks/legacy: address Postgres-specific issues
webhooks/legacy_test.go: style
webhooks/legacy: update only affected delivery
Forgot to add this where clause, whoops!
Add legacy webhooks worker implementation