Skip to content

Commit

Permalink
Merge pull request #45 from saracen/gomaxprocs
Browse files Browse the repository at this point in the history
Use GOMAXPROCS for concurrency default, not NumCPU
  • Loading branch information
saracen authored Jun 9, 2023
2 parents b121721 + f3f08fb commit 35c9d55
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func NewArchiver(w io.Writer, chroot string, opts ...ArchiverOption) (*Archiver,
}

a.options.method = zip.Deflate
a.options.concurrency = runtime.NumCPU()
a.options.concurrency = runtime.GOMAXPROCS(0)
a.options.stageDir = chroot
a.options.bufferSize = -1
for _, o := range opts {
Expand Down
2 changes: 1 addition & 1 deletion archiver_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func WithArchiverMethod(method uint16) ArchiverOption {
}

// WithArchiverConcurrency will set the maximum number of files to be
// compressed concurrently. The default is set to runtime.NumCPU().
// compressed concurrently. The default is set to GOMAXPROCS.
func WithArchiverConcurrency(n int) ArchiverOption {
return func(o *archiverOptions) error {
if n <= 0 {
Expand Down
2 changes: 1 addition & 1 deletion extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func newExtractor(r *zip.Reader, c io.Closer, chroot string, opts []ExtractorOpt
closer: c,
}

e.options.concurrency = runtime.NumCPU()
e.options.concurrency = runtime.GOMAXPROCS(0)
for _, o := range opts {
err := o(&e.options)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion extractor_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type extractorOptions struct {
}

// WithExtractorConcurrency will set the maximum number of files being
// extracted concurrently. The default is GOMAXPROCS.
// extracted concurrently. The default is set to GOMAXPROCS.
func WithExtractorConcurrency(n int) ExtractorOption {
return func(o *extractorOptions) error {
if n <= 0 {
Expand Down

0 comments on commit 35c9d55

Please sign in to comment.