Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#88 streaming parse with generator - handling thread termination #99

Conversation

bzamecnik
Copy link
Contributor

No description provided.

sirex and others added 10 commits March 25, 2015 18:44
The only way I could implement generator is by using `threading` module. I
tried to play with `generator.send`, but without luck. I could not find any
other solution, how to give control outside of callback.

With this implementation using `threading` module I see the only issue with
incomplete parsing. For example:

    data = '<a x="y"><b>1</b><b>2</b><b>3</b></a>'
    next(parse(data, item_depth=2))

Here, we take only single item and a thread is left waiting for queue forever.
Since threads are daemonic, they will not block process termination, but in
cases, where many daemonic threads will be left running, then it will leak
memory.
…roducer thread after a timeout.

Add another test case - close the generator by a break in the for loop.
This means that the result from parse() in the streaming configuration has to be used from within the 'with' keyword.
@javadev
Copy link

javadev commented Nov 21, 2018

This branch has conflicts that must be resolved

@martinblech martinblech closed this May 8, 2022
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.

None yet

4 participants