Multithreading
Lunatixz opened this issue · 5 comments
@PseudoTV/developers
Unfortunately because of python's serialization, keeping a snappy, smooth interface is challenging.
I've been forced to use thread.timers to "queue" jobs, allowing users to move freely through the interface without being bogged down by background tasks.
There has to be a neater solution, perhaps a single run, worker thread?
Not asking anyone to break their backs on this one, I'd be fine keeping the thread.timer's.. If you already know python multithreading... maybe take a look for me?
I can't remember: was the original Psuedo-TV written using the buggalo library or was it the TV Guide addon? I've used buggalo a couple of times, but it's really not much of an improvement over well written worker threads.
TVGuide uses buggalo, same creator... it's a exception collector... I'm not really using it, but its setup on my website...
Yeah you're right it's for exceptions, not thread management. I'll have a look at what you're doing with the thread timers and see if I can help with some ideas.
This is what I was thinking of (don't know why I thought it was buggalo): https://pypi.python.org/pypi/threading2/
It allows for priorities and thread group management. Possible problem is that it doesn't support all platforms.
This looks cool, but i'm lost when it comes to multithreading... Synchronization of jobs is key, otherwise you get functions returning data randomly. The current state of threading for PseudoTV Live is pretty basic, I queue only jobs that don't require a direct return ie. downloading a file...
All other threads cancel the last job if its still running in favor of executing the newest call. So i'm only taking advantage of the parallel threading. This frees up function wait times, so the interface appears snappy and smooth to the user.