Skip to content

Commit

Permalink
Drop default on_fail. (#3479)
Browse files Browse the repository at this point in the history
  • Loading branch information
toots authored Oct 31, 2023
1 parent 1e91115 commit 4faf5e9
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/libs/playlist.liq
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ end
# whole round ("randomize" mode), or pick a random file in the playlist each time \
# ("random" mode).
# @param ~native Use native implementation.
# @param ~on_fail Function executed when too many requests failed and returning the contents of a fixed playlist.
# @param ~on_reload Callback called after playlist has reloaded.
# @param ~prefix Add a constant prefix to all requests. Useful for passing extra \
# information using annotate, or for resolution through a particular protocol, \
Expand All @@ -364,6 +365,7 @@ def replaces playlist(
~mime_type=null(),
~mode="randomize",
~native=false,
~on_fail=null(),
~on_reload=(fun (_) -> ()),
~prefix="",
~reload=0,
Expand Down Expand Up @@ -409,28 +411,6 @@ def replaces playlist(
list.map.right(fun (file) -> prefix ^ file, files)
end

# Try to reload playlist when the playlist is looped and has failed.
def on_fail() =
l = load_playlist()
if
l == []
then
log.info(
"Failed to reload playlist after failure."
)

# We add a dummy request in order for the playlist not to stop.
["???failed???"]
else
log.info(
"Successfully reload playlist after failure."
)
l
end
end

on_fail = if loop then on_fail else null() end

# Create the source
files := load_playlist()

Expand Down

0 comments on commit 4faf5e9

Please sign in to comment.