mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-22 18:56:31 +00:00
parent
b086e4c2a1
commit
74c0c13fbd
@ -24,6 +24,13 @@ const errors = require('./error-types')
|
|||||||
const CHUNK_SIZE = 64 * 1024
|
const CHUNK_SIZE = 64 * 1024
|
||||||
const MIN_CHUNK_SIZE = 512
|
const MIN_CHUNK_SIZE = 512
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary I/O retry base timeout, in milliseconds
|
||||||
|
* @constant
|
||||||
|
* @type {Number}
|
||||||
|
*/
|
||||||
|
const RETRY_BASE_TIMEOUT = 100
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary BlockReadStream
|
* @summary BlockReadStream
|
||||||
* @class
|
* @class
|
||||||
@ -91,7 +98,9 @@ class BlockReadStream extends stream.Readable {
|
|||||||
|
|
||||||
if (isTransient && (this.retries < this.maxRetries)) {
|
if (isTransient && (this.retries < this.maxRetries)) {
|
||||||
this.retries += 1
|
this.retries += 1
|
||||||
this._read()
|
setTimeout(() => {
|
||||||
|
this._read()
|
||||||
|
}, RETRY_BASE_TIMEOUT * this.retries)
|
||||||
return
|
return
|
||||||
} else if (isTransient) {
|
} else if (isTransient) {
|
||||||
error.code = 'EUNPLUGGED'
|
error.code = 'EUNPLUGGED'
|
||||||
|
@ -25,6 +25,13 @@ const errors = require('./error-types')
|
|||||||
const CHUNK_SIZE = 64 * 1024
|
const CHUNK_SIZE = 64 * 1024
|
||||||
const UPDATE_INTERVAL_MS = 500
|
const UPDATE_INTERVAL_MS = 500
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary I/O retry base timeout, in milliseconds
|
||||||
|
* @constant
|
||||||
|
* @type {Number}
|
||||||
|
*/
|
||||||
|
const RETRY_BASE_TIMEOUT = 100
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary BlockWriteStream
|
* @summary BlockWriteStream
|
||||||
* @class
|
* @class
|
||||||
@ -154,7 +161,9 @@ class BlockWriteStream extends stream.Writable {
|
|||||||
|
|
||||||
if (isTransient && (this.retries < this.maxRetries)) {
|
if (isTransient && (this.retries < this.maxRetries)) {
|
||||||
this.retries += 1
|
this.retries += 1
|
||||||
this._write(chunk, encoding, next)
|
setTimeout(() => {
|
||||||
|
this._write(chunk, encoding, next)
|
||||||
|
}, RETRY_BASE_TIMEOUT * this.retries)
|
||||||
return
|
return
|
||||||
} else if (isTransient) {
|
} else if (isTransient) {
|
||||||
error.code = 'EUNPLUGGED'
|
error.code = 'EUNPLUGGED'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user