mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 02:11:34 +08:00
refactoring
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user