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

Allow optionally setting daemon flag on async threads. #1126

Merged
merged 2 commits into from
Mar 20, 2019

Conversation

mmontagna
Copy link
Contributor

@mmontagna mmontagna commented Nov 7, 2018

Would you be open to a PR which sets the daemon flag on async threads?

https://docs.python.org/3/library/threading.html#threading.Thread.daemon

This will allow python scripts to exit cleanly when all non-daemon threads are stopped. The current behavior is that the streaming thread stays up and prevents the script from exiting.

[EDIT]
Changed PR to optionally allow setting daemon flag, but maintain the default behavior of setting it to false.

@mmontagna
Copy link
Contributor Author

Ahh I see this PR already existed: #268

@mmontagna
Copy link
Contributor Author

What if it was added as an option which could be passed to the functions which start async threads?

@mmontagna mmontagna changed the title Set daemon flag on async threads. Allow optionally setting daemon flag on async threads. Nov 7, 2018
@joshthecoder
Copy link
Member

Yeah I think adding this as an option makes sense. How about we pass it to the "options" object the constructor receives? Then you can just assign it to self like we do for the other options (default is false).

# The first commit's message is:
Set daemon flag on async threads.

# The 2nd commit message will be skipped:

#	Allow optionally setting thread's daemon but default to false.

# The 3rd commit message will be skipped:

#	Revert "Allow optionally setting thread's daemon but default to false."
#
#	This reverts commit fd27bc2.
@mmontagna
Copy link
Contributor Author

@joshthecoder Alright I've updated the PR to make it an option to the Stream constructor. What do you think now?

Also are there any docs I should update?

@joshthecoder
Copy link
Member

Looks good now thanks! Sorry for the long wait on seeing this again

@joshthecoder joshthecoder merged commit cc3c8e7 into tweepy:master Mar 20, 2019
@Harmon758 Harmon758 added the Improvement This is regarding an improvement to an existing feature label May 3, 2019
@Harmon758 Harmon758 added this to the 3.8 milestone Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement This is regarding an improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants