Skip to content

Commit caf4964

Browse files
author
Raphaël Droz
authored
FlowChunk: xhr abort fixes (#351)
* FlowChunk: In case a superfluous chunks was anticipated (in stream-mode), correctly handle possible `abort()` event * FlowChunk: Fix an apparent inconsistency within FlowChunk::abort() behavior (d64592c)
1 parent 0eb7bbb commit caf4964

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/FlowChunk.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export default class FlowChunk {
346346
// We make a fake request so that overall status is "complete" and we can move on
347347
// on this FlowFile.
348348
this.pendingRetry = false;
349-
this.xhr = {readyState: 5, status: 1 };
349+
this.xhr = {readyState: 4, status: 200, abort: e => null };
350350
this.doneHandler(null);
351351
return;
352352
}
@@ -428,12 +428,10 @@ export default class FlowChunk {
428428
* @function
429429
*/
430430
abort() {
431-
// Abort and reset
432-
var xhr = this.xhr;
433-
this.xhr = null;
434-
if (xhr) {
435-
xhr.abort();
431+
if (this.xhr) {
432+
this.xhr.abort();
436433
}
434+
this.xhr = null;
437435
}
438436

439437
/**

0 commit comments

Comments
 (0)