Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit a36b1d3

Browse files
committed
Handle all errors on upload
1 parent 86d2460 commit a36b1d3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/deploy/upload-files.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const pMap = require('p-map')
22
const fs = require('fs')
33
const backoff = require('backoff')
4+
const debug = require('debug')('netlify:deploy')
45

56
module.exports = uploadFiles
67
async function uploadFiles(api, deployId, uploadList, { concurrentUpload, statusCb, maxRetry }) {
@@ -71,8 +72,8 @@ function retryUpload(uploadFn, maxRetry) {
7172
let lastError
7273
const fibonacciBackoff = backoff.fibonacci({
7374
randomisationFactor: 0.5,
74-
initialDelay: 100,
75-
maxDelay: 10000
75+
initialDelay: 5000,
76+
maxDelay: 90000
7677
})
7778
fibonacciBackoff.failAfter(maxRetry)
7879

@@ -93,8 +94,11 @@ function retryUpload(uploadFn, maxRetry) {
9394
.catch(e => {
9495
lastError = e
9596
switch (true) {
96-
case e.status === 408: // request timeout
97+
case e.status >= 400: // observed errors: 408, 401 (4** swallowed), 502
9798
case e.name === 'FetchError': {
99+
debug(`Upload failed... retrying`)
100+
const msg = e.json || e.data
101+
if (msg) debug('O%', msg)
98102
return fibonacciBackoff.backoff()
99103
}
100104
default: {

0 commit comments

Comments
 (0)