Skip to content

Commit

Permalink
Add failure callback to tenaciousFetch
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Aug 28, 2018
1 parent 446c1f2 commit 5b9faa5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/JBrowse/Model/XHRBlob.js
Expand Up @@ -15,7 +15,7 @@ function fetchBinaryRange(url, start, end) {
return tenaciousFetch(url, {
method: 'GET',
headers: { range: `bytes=${start}-${end}` },
retries: 5,
retries: 1,
retryDelay: 1000, // 1 sec, 2 sec, 3 sec
retryStatus: [500, 404, 503],
onRetry: ({retriesLeft, retryDelay}) => {
Expand Down Expand Up @@ -59,6 +59,8 @@ function fetchBinaryRange(url, start, end) {
responseDate,
buffer: Buffer.from(arrayBuffer),
}))
}, res => {
throw new Error(`HTTP ${res.status} when fetching ${url} bytes ${start}-${end}`)
})
}
const globalCache = new HttpRangeFetcher({
Expand Down

0 comments on commit 5b9faa5

Please sign in to comment.