mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust conditions
This commit is contained in:
parent
82f3bcc65e
commit
e024586ff1
|
@ -59,7 +59,8 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
|
||||||
|
|
||||||
contentLength := getContentLength(r)
|
contentLength := getContentLength(r)
|
||||||
// exclude the replication from the concurrentUploadLimitMB
|
// exclude the replication from the concurrentUploadLimitMB
|
||||||
if r.URL.Query().Get("type") != "replicate" && vs.concurrentUploadLimit != 0 {
|
shouldWatchUploadLimit := r.URL.Query().Get("type") != "replicate" && vs.concurrentUploadLimit != 0
|
||||||
|
if shouldWatchUploadLimit {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
vs.inFlightUploadDataLimitCond.L.Lock()
|
vs.inFlightUploadDataLimitCond.L.Lock()
|
||||||
for vs.inFlightUploadDataSize > vs.concurrentUploadLimit {
|
for vs.inFlightUploadDataSize > vs.concurrentUploadLimit {
|
||||||
|
@ -79,7 +80,7 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
|
||||||
atomic.AddInt64(&vs.inFlightUploadDataSize, contentLength)
|
atomic.AddInt64(&vs.inFlightUploadDataSize, contentLength)
|
||||||
defer func() {
|
defer func() {
|
||||||
atomic.AddInt64(&vs.inFlightUploadDataSize, -contentLength)
|
atomic.AddInt64(&vs.inFlightUploadDataSize, -contentLength)
|
||||||
if vs.concurrentUploadLimit != 0 {
|
if shouldWatchUploadLimit {
|
||||||
vs.inFlightUploadDataLimitCond.Signal()
|
vs.inFlightUploadDataLimitCond.Signal()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in a new issue