Skip to content

option: itemLimit has no effect #4

@busticated

Description

@busticated

hey there -
thanks for putting together this lib. i was giving it a try and noticed something odd: the itemLimit option doesn't appear to do anything. i put together a quick PR w/ a failing test here --> #3

poking at the code, i noticed a couple of things:

  • .isLimitReached() (here) will return true exactly once. so callers basically never bail out (example)
  • breaking that if clause up such that we return early - e.g. if (this.isEnding){ return true; }, makes my failing test pass but when i use the module in my main project, i get Uncaught Error: write after end...
  • ...if you add a few console.log() calls, you instead get Uncaught Error: Unexpected end from sax (here). so there's a race going on in there somewhere (>_<)
  • trying to clean up before ending by calling combinations of this.stream.end(), this.stream._parser.close(), this.stream.removeAllListeners(), etc resulted in either an infinite loop + blown stack or Uncaught Error: Unexpected end from sax.

fwiw, i'm running node v4.3.1 on os-x.

hope it helps!
-matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions