Browse Source

Merge pull request #2759 from kmlebedev/skip_wait_cancelled_request

Need to exit waiting if request is was canceled
pull/2817/head
Chris Lu 3 years ago
committed by GitHub
parent
commit
89d84e275b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      weed/server/volume_server_handlers.go

6
weed/server/volume_server_handlers.go

@ -40,9 +40,15 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
stats.ReadRequest()
vs.inFlightDownloadDataLimitCond.L.Lock()
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)
vs.inFlightDownloadDataLimitCond.Wait()
}
}
vs.inFlightDownloadDataLimitCond.L.Unlock()
vs.GetOrHeadHandler(w, r)
case "DELETE":

Loading…
Cancel
Save