File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ gosdk-build: gomod-download
3535 go build -x -v -tags bn256 ./...
3636
3737wasm-build : getrev
38- CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -buildvcs=false -o ./zcn.wasm ./wasmsdk
38+ CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -ldflags= " -s -w " - buildvcs=false -o ./zcn.wasm ./wasmsdk
3939
4040wasm-test : wasm-build
4141 env -i $(shell go env) PATH=" $( shell go env GOROOT) /misc/wasm:$( PATH) " CGO_ENABLED=0 GOOS=js GOARCH=wasm go test -v github.com/0chain/gosdk/wasmsdk/jsbridge/...
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package main
66import (
77 "errors"
88 "fmt"
9+ "runtime/debug"
910 "sync"
1011 "time"
1112
@@ -271,6 +272,8 @@ func main() {
271272 }
272273
273274 hideLogs ()
275+ debug .SetGCPercent (40 )
276+ debug .SetMemoryLimit (2.5 * 1024 * 1024 * 1024 ) //2.5 GB
274277
275278 <- make (chan bool )
276279
Original file line number Diff line number Diff line change @@ -253,6 +253,7 @@ func SetMultiOpBatchSize(size int) {
253253func SetWasm () {
254254 IsWasm = true
255255 BatchSize = 5
256+ extraCount = 0
256257}
257258
258259func getPriceRange (name string ) (PriceRange , error ) {
Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ import (
3838const (
3939 DOWNLOAD_CONTENT_FULL = "full"
4040 DOWNLOAD_CONTENT_THUMB = "thumbnail"
41- EXTRA_COUNT = 2
41+ )
42+
43+ var (
44+ extraCount = 2
4245)
4346
4447type DownloadRequestOption func (dr * DownloadRequest )
@@ -531,7 +534,7 @@ func (req *DownloadRequest) processDownload() {
531534 }
532535 req .bufferMap = nil
533536 }()
534- sz := downloadWorkerCount + EXTRA_COUNT
537+ sz := downloadWorkerCount + extraCount
535538 if sz > n {
536539 sz = n
537540 }
@@ -684,7 +687,7 @@ func (req *DownloadRequest) processDownload() {
684687 firstReqWG := sync.WaitGroup {}
685688 firstReqWG .Add (1 )
686689 eg , egCtx := errgroup .WithContext (ctx )
687- eg .SetLimit (downloadWorkerCount + EXTRA_COUNT )
690+ eg .SetLimit (downloadWorkerCount + extraCount )
688691 for i := 0 ; i < n ; i ++ {
689692 j := i
690693 if i == 1 {
You can’t perform that action at this time.
0 commit comments