Add download speed limit support (#3408)
This commit is contained in:
@@ -68,6 +68,7 @@ type FilerOption struct {
|
||||
SaveToFilerLimit int64
|
||||
ConcurrentUploadLimit int64
|
||||
ShowUIDirectoryDelete bool
|
||||
DownloadMaxBytesPs int64
|
||||
}
|
||||
|
||||
type FilerServer struct {
|
||||
|
||||
@@ -238,7 +238,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
}
|
||||
|
||||
err = filer.StreamContent(fs.filer.MasterClient, writer, chunks, offset, size)
|
||||
err = filer.StreamContentWithThrottler(fs.filer.MasterClient, writer, chunks, offset, size, fs.option.DownloadMaxBytesPs)
|
||||
if err != nil {
|
||||
stats.FilerRequestCounter.WithLabelValues(stats.ErrorReadStream).Inc()
|
||||
glog.Errorf("failed to stream content %s: %v", r.URL, err)
|
||||
|
||||
Reference in New Issue
Block a user