Fix onFlushTimeout timer not being cleared when upstream errors (#1616)
This commit is contained in:
committed by
GitHub
parent
e7c5b3dafa
commit
d01582803c
@ -355,6 +355,7 @@ export default class Helpers {
|
|||||||
let loadedOperations = 0
|
let loadedOperations = 0
|
||||||
timeoutRef = setTimeout(onFlushTimeout, flushInterval) // eslint-disable-line
|
timeoutRef = setTimeout(onFlushTimeout, flushInterval) // eslint-disable-line
|
||||||
|
|
||||||
|
try {
|
||||||
for await (const operation of operationsStream) {
|
for await (const operation of operationsStream) {
|
||||||
timeoutRef.refresh()
|
timeoutRef.refresh()
|
||||||
loadedOperations += 1
|
loadedOperations += 1
|
||||||
@ -368,8 +369,10 @@ export default class Helpers {
|
|||||||
loadedOperations = 0
|
loadedOperations = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
clearTimeout(timeoutRef)
|
clearTimeout(timeoutRef)
|
||||||
|
}
|
||||||
|
|
||||||
// In some cases the previos http call does not have finished,
|
// In some cases the previos http call does not have finished,
|
||||||
// or we didn't reach the flush bytes threshold, so we force one last operation.
|
// or we didn't reach the flush bytes threshold, so we force one last operation.
|
||||||
if (loadedOperations > 0) {
|
if (loadedOperations > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user