~gioverse/chat

b724dfa572d63ef90dc11c7ab61d27d48c70cbac — Jack Mordaunt 2 months ago 84203ce
async: limit workers on FixedWorkerPool

I thought I had fixed this, but it turns out I had only
limited one of the worker pools!

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
1 files changed, 1 insertions(+), 1 deletions(-)

M async/loader.go
M async/loader.go => async/loader.go +1 -1
@@ 223,7 223,7 @@ func (l *Loader) Schedule(tag Tag, load LoadFunc) Resource {
			// 128 is a magic number of maximum workers we will allow.
			// This would translate to "max number of network requests", if all
			// work were to be network-bound.
			l.Scheduler = &FixedWorkerPool{Workers: 128}
			l.Scheduler = &FixedWorkerPool{Workers: runtime.NumCPU()}
		}
		// TODO(jfm): expose context in the public api so that loads can be
		// cancelled by it.