~bigbes/core-go: 7457c44b

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>

Robin Jarry <robin@jarry.cc> — 2024-12-14 22:53:26 UTC

Commit 7457c44be5ec4f9247154d2fdec2fe8885db3f45view raw patch

Parent(s): 562662dc

7 changed file(s)

FileStatus+
email/worker.go M +10 -1
go.mod M +1 -1
go.sum M +2 -2
server/server.go M +16 -8
webhooks/legacy.go M +11 -2
webhooks/legacy_test.go M +18 -24
webhooks/queue.go M +11 -2