mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Need to exit waiting if request is was canceled
This commit is contained in:
parent
2eda3a686f
commit
f43c6daeda
|
@ -39,9 +39,15 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
|
||||||
stats.ReadRequest()
|
stats.ReadRequest()
|
||||||
vs.inFlightDownloadDataLimitCond.L.Lock()
|
vs.inFlightDownloadDataLimitCond.L.Lock()
|
||||||
for vs.concurrentDownloadLimit != 0 && atomic.LoadInt64(&vs.inFlightDownloadDataSize) > vs.concurrentDownloadLimit {
|
for vs.concurrentDownloadLimit != 0 && atomic.LoadInt64(&vs.inFlightDownloadDataSize) > vs.concurrentDownloadLimit {
|
||||||
|
select {
|
||||||
|
case <-r.Context().Done():
|
||||||
|
glog.V(4).Infof("request cancelled from %s: %v", r.RemoteAddr, r.Context().Err())
|
||||||
|
return
|
||||||
|
default:
|
||||||
glog.V(4).Infof("wait because inflight download data %d > %d", vs.inFlightDownloadDataSize, vs.concurrentDownloadLimit)
|
glog.V(4).Infof("wait because inflight download data %d > %d", vs.inFlightDownloadDataSize, vs.concurrentDownloadLimit)
|
||||||
vs.inFlightDownloadDataLimitCond.Wait()
|
vs.inFlightDownloadDataLimitCond.Wait()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
vs.inFlightDownloadDataLimitCond.L.Unlock()
|
vs.inFlightDownloadDataLimitCond.L.Unlock()
|
||||||
vs.GetOrHeadHandler(w, r)
|
vs.GetOrHeadHandler(w, r)
|
||||||
case "DELETE":
|
case "DELETE":
|
||||||
|
|
Loading…
Reference in a new issue