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

Get rid of threads #18

Open
double-fault opened this issue Apr 14, 2019 · 2 comments
Open

Get rid of threads #18

double-fault opened this issue Apr 14, 2019 · 2 comments

Comments

@double-fault
Copy link
Member

For some reason, threading in Python isn't really preferred (I never could understand why...). The BackgroundTaskManager currently uses threads to schedule and run various tasks simultaneously.

Since the code already exists, I don't plan on discarding it, but an option to not use threads would be rather nice. In such situations, an alternative function belonging to the Bot class will need to be called in an infinite loop, which will schedule the tasks using a simple check of elapsed time.

This change, along with a couple of bugfixes should be enough for version 1.

@tripleee
Copy link
Collaborator

tripleee commented Apr 14, 2019

ChatExchange uses threading anyway, so I really don't know if this makes sense. Perhaps if ChatExchange went async, it would make sense for us to follow suit.

(I'm certainly a threading skeptic, so I'm all for it in principle. No objection if we can lead the way; but I doubt our example could compel upstream to make large architectural changes.)

@double-fault
Copy link
Member Author

@tripleee I've used threads quite a lot, and I usually don't see any problem with them, but switching away from threads in the BackgroundTaskManager will have other advantages, IMO.

Currently, every task has it's own thread, which could make it difficult to debug some situations. Plus, async should use a lot less memory than the current threading system.

This isn't very high on my priority list (whenever I actually get time..), since some other bugs exist which block some functionality. But, I guess, it could be something nice to have.

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

No branches or pull requests

2 participants