~netlandish/gobwebs

b82c01404952d5850c69c896b6af7d011a1dc202 — Peter Sanchez 3 days ago bc81c15
Final worker size for new dowork version. Also dowork bump
3 files changed, 12 insertions(+), 4 deletions(-)

M go.mod
M go.sum
M server/server.go
M go.mod => go.mod +1 -1
@@ 3,7 3,7 @@ module netlandish.com/x/gobwebs
go 1.20

require (
	git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c
	git.sr.ht/~sircmpwn/dowork v0.0.0-20241219115748-a3928eb084db
	github.com/Masterminds/squirrel v1.5.4
	github.com/alexedwards/argon2id v1.0.0
	github.com/alexedwards/scs/postgresstore v0.0.0-20240316134038-7e11d57e8885

M go.sum => go.sum +2 -2
@@ 31,8 31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c h1:v2opuaN0C5ZpuCifRNR9ZQ8V9IG+Ja80otK1MFj5RnI=
git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
git.sr.ht/~sircmpwn/dowork v0.0.0-20241219115748-a3928eb084db h1:NX+qg2ZkefnAWL1TvdgumYBggN2f2zYGYQJxIaqaQ5s=
git.sr.ht/~sircmpwn/dowork v0.0.0-20241219115748-a3928eb084db/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=

M server/server.go => server/server.go +9 -1
@@ 473,7 473,15 @@ func (s *Server) WithQueues(queues ...*work.Queue) *Server {
	for _, queue := range queues {
		ctx, cancel := context.WithCancel(context.Background())
		s.queuecan[queue.Name()] = cancel
		queue.Start(ctx)
		qSize := int(queue.Size() / 10) // Random, just take 10% of size for worker pool
		// For now this is probably fine. We should work in a way for this to be configurable
		// per queue.
		if qSize < 1 {
			qSize = 1
		} else if qSize > 5 {
			qSize = 5
		}
		queue.Start(ctx, qSize)
	}
	return s
}