Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
perf: limit concurrent builds (based on number of CPUs, max to 2)
Browse files Browse the repository at this point in the history
szkiba committed Oct 18, 2023
1 parent 5f95e99 commit 50ed7ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/cmd/cmd_service.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ package cmd

import (
"context"
"math"
"net"
"net/http"
"os"
@@ -58,7 +59,9 @@ func serviceCommand(

defer l.Close() //nolint:errcheck

return server.Serve(netutil.LimitListener(l, runtime.NumCPU()))
limit := int(math.Max(2, float64(runtime.NumCPU())/4.0))

return server.Serve(netutil.LimitListener(l, limit))
}

func recovery(handler http.Handler) http.Handler {

0 comments on commit 50ed7ff

Please sign in to comment.