aboutsummaryrefslogtreecommitdiff
path: root/commitquery/queries_new.go
blob: 5eae7990e84daa2c465feb27a4542022682d5581 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package commitquery

import (
	"runtime"

	commitgraphread "codeberg.org/lindenii/furgit/format/commitgraph/read"
	objectfetch "codeberg.org/lindenii/furgit/object/fetch"
)

// New builds one concurrent-safe commit query service over one object fetcher
// and optional commit-graph reader.
//
// Labels: Deps-Borrowed, Life-Parent.
func New(fetcher *objectfetch.Fetcher, graph *commitgraphread.Reader) *Queries {
	maxIdle := max(runtime.GOMAXPROCS(0), 1)

	return &Queries{
		fetcher: fetcher,
		graph:   graph,
		maxIdle: maxIdle,
	}
}