Skip to content

Race condition when using preprocess #18

@tateman66

Description

@tateman66

Hey Guys.

I think I've found an issue with using preprocess and filesuccess. I'm calling preprocessFinished on each chunk from inside of my preprocess function. The problem is that immediately after my preprocess function returns you have this line in the chunk send method:

this.preprocessState = 1;

So, eventhough the state was just set to 2 in the preprocessFinished method, it has now been set back to 1 after my custom function is run.

Because all chunks stay at 1, the isComplete never returns true and the fileSuccess handler is never called because of this if statement:

if (this.isComplete()) {
this.currentSpeed = 0;
this.averageSpeed = 0;
this.flowObj.fire('fileSuccess', this, message);
}

Am I approaching this wrong at all? Why does the preprocessState of a chunk need to be set to 1 after it's just been set to 2?

I've basically just commented out the line that sets the preprocessState to 1.

Thanks,
Steven Tate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions