#44: High CPU usage on empty or bad playlists
-------------------------+--------------------------------------------------
Reporter: toots | Owner: admin
Type: Bugs | Status: new
Priority: 1 | Milestone:
Component: Liquidsoap | Version: 0.3.3
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Comment (by mrpingouin):
I believe that this is a known issue, more general: request-based sources
poll actively without any delay between two attempts. I discussed that
with some guy, but can't remember where. So here are a few details for the
record.
I don't see any other option than active polling, especially for
request.external(). In the case of playlists, the polling for audio
requests could be desactivated until the request for the playlist
successfully yields a non-empty one, but this only solves part of the
problem. (In the case of request.external() a delay can be artificially
introduced by adding a "sleep N" on failure in the external script.)
Initially I didn't put any delay between two polls, in order to avoid a
latency before getting a new request, but this is too much: a 1 second
delay wouldn't hurt much and would relieve the CPU a lot.
One solution would be to add another parameter in the base request_source
class ("delay", next to "timeout", "default_duration", etc.) and export it
to all derived classes (playlists, single, request.*).
--
Ticket URL: <http://savonet.rastageeks.org/ticket/44#comment:1>
Savonet <http://savonet.rastageeks.org/>
Let's program our stream !