Skip to content

Call the next() function at the right place, remove the redundant 'utf8' encoding. - #747

Closed
lygstate wants to merge 2 commits into
restify:masterfrom
lygstate:master
Closed

lygstate wants to merge 2 commits into
restify:masterfrom
lygstate:master

Conversation

@lygstate

@lygstate lygstate commented Feb 3, 2015

Copy link
Copy Markdown

No description provided.

@yunong

yunong commented Feb 25, 2015

Copy link
Copy Markdown
Contributor

Hi, thanks for doing this, could you give me some context about this PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe next could be called multiple times if you move it in here.

i === length will be subject to a race condition depending on the speed of the filesystem. If files is an array of 10, and you read all 10 files, you will be checking a length of 10, to 1 - 10, but conceivably you could read the first file, before the next forEach loop is run, which would be length === 1 and i === 1.

If you are looking for a way to ensure that you call next after all files have been read, then the check should be more resilient to race conditions.

@yunong

yunong commented Jul 20, 2015

Copy link
Copy Markdown
Contributor

no longer an issue since it's fixed as part of #847

@yunong yunong closed this Jul 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants