aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/filer_server_handlers_write_upload.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.go
index 21af6a109..25275cf05 100644
--- a/weed/server/filer_server_handlers_write_upload.go
+++ b/weed/server/filer_server_handlers_write_upload.go
@@ -5,8 +5,8 @@ import (
"hash"
"io"
"io/ioutil"
- "math/rand"
"net/http"
+ "runtime"
"strings"
"sync"
"time"
@@ -20,6 +20,10 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
)
+var (
+ limitedUploadProcessor = util.NewLimitedOutOfOrderProcessor(int32(runtime.NumCPU()))
+)
+
func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Request, reader io.Reader, chunkSize int32, fileName, contentType string, contentLength int64, so *operation.StorageOption) (fileChunks []*filer_pb.FileChunk, md5Hash hash.Hash, dataSize int64, err error, smallContent []byte) {
md5Hash = md5.New()
@@ -58,7 +62,7 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
for readErr == nil {
wg.Add(1)
- operation.AsyncOutOfOrderProcess(rand.Uint32(), func() {
+ limitedUploadProcessor.Execute(func() {
defer wg.Done()
var localOffset int64