Re: idleStreams
Michael Herger <slim-b/[email protected]> Thu, 3 Nov 2022 17:34:20 +0100
| Newsgroups | gmane.music.equipment.slimdevices.devel |
|---|---|
| Message-ID | <[email protected]> |
> From what I can see, -idleStreams- is supposed to give the server some > time to breathe when a task takes a bit longer so that streaming is not > interrupted and such. Apparently, it's often used in loops (at the end > of each iteration). Correct. > How does it actually work? I don't know in detail, tbh. It's similar to Windows <= 9x collaborative multitasking: only one thread can use the CPU at any time. And then you have to tell the scheduler when you want to give the others air to breath. That's why it's called "collaborative": a long running task can lock things up if it doesn't idle for a while. > Does it pause the current task and execute > tasks from some queue? If so, how many tasks from what queue would it > complete before resuming the original task that called idlestreams? This part I don't know. > My case: if I have a task (not a loop) that consists of various sub > tasks (retrieving tracks from db using SQLite query, filtering, > sorting), should I use it? Is there some kind of guideline on when it > makes sense to use it? My personal guideline is: if a task takes longer than a second or two, try to split it, idling in between. > Ex.: subtask1 ~16 secs -> subtask2 ~4 secs -> subtask3 ~5 secs. > Should I call idlestreams after subtask*1* in this case or is it > primarily intended for loops/iterations? The exec time of these subtasks > approx. doubles when the number of tracks requested is doubled. 16s is a very long time. It certainly will cause issues streaming to players with small buffers. Is there no way you can break that up into smaller chunks? Or could you run the plugin as part of the scanner?