From 6853cfc804dd0723fead353ec06dc8a7fca99f1b Mon Sep 17 00:00:00 2001 From: Anders Leung <37423859+andersleung@users.noreply.github.com> Date: Mon, 6 Jul 2020 10:15:12 -0400 Subject: [PATCH] Fix chunking behavior, shrink chunk size --- internal/htsgetserver/readsticket.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/internal/htsgetserver/readsticket.go b/internal/htsgetserver/readsticket.go index 2d3a723..41f6289 100644 --- a/internal/htsgetserver/readsticket.go +++ b/internal/htsgetserver/readsticket.go @@ -60,15 +60,6 @@ func getReadsTicket(writer http.ResponseWriter, request *http.Request) { } res, _ := http.Head(config.DataSourceURL + htsgetutils.FilePath(htsgetReq.ID())) numBytes := res.ContentLength - var numBlocks int - var blockSize int64 = 1e9 - if htsgetReq.AllRegionsRequested() { - numBlocks = 1 - } else { - if len(htsgetReq.Fields()) == 0 { - numBlocks = int(math.Ceil(float64(numBytes) / float64(blockSize))) - } - } // build HTTP response u := make([]urlJSON, 0) @@ -88,6 +79,10 @@ func getReadsTicket(writer http.ResponseWriter, request *http.Request) { u = append(u, urlJSON{dataEndpoint.String(), h, "header"}) } else if htsgetReq.AllFieldsRequested() && htsgetReq.AllTagsRequested() && htsgetReq.AllRegionsRequested() { + var numBlocks int + var blockSize int64 = 5e8 + numBlocks = int(math.Ceil(float64(numBytes) / float64(blockSize))) + path := config.DataSourceURL + htsgetutils.FilePath(htsgetReq.ID()) var start, end int64 = 0, 0