Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Commit 6cb6c2f

Browse files
authored
Merge pull request #99 from kochd/master
add -no-limit parameter
2 parents a86bc07 + aaf0d1f commit 6cb6c2f

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

albiondata-client.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ func init() {
128128
false,
129129
"Ignore the decoding errors when debugging",
130130
)
131+
132+
flag.BoolVar(
133+
&client.ConfigGlobal.NoCPULimit,
134+
"no-limit",
135+
false,
136+
"Use all available CPU cores",
137+
)
131138
}
132139

133140
func main() {

client/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type config struct {
2121
RecordPath string
2222
PrivateIngestBaseUrls string
2323
PublicIngestBaseUrls string
24+
NoCPULimit bool
2425
}
2526

2627
//ConfigGlobal global config data

client/uploader_http_pow.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ type Pow struct {
2828
// newHTTPUploaderPow creates a new HTTP uploader
2929
func newHTTPUploaderPow(url string) uploader {
3030

31-
// Limit to 25% of available cpu cores
32-
procs := runtime.NumCPU() / 4
33-
if procs < 1 {
34-
procs = 1
31+
if !ConfigGlobal.NoCPULimit {
32+
// Limit to 25% of available cpu cores
33+
procs := runtime.NumCPU() / 4
34+
if procs < 1 {
35+
procs = 1
36+
}
37+
runtime.GOMAXPROCS(procs)
3538
}
36-
runtime.GOMAXPROCS(procs)
3739

3840
return &httpUploaderPow{
3941
baseURL: strings.Replace(url, "http+pow", "http", -1),

0 commit comments

Comments
 (0)