Skip to content

Commit

Permalink
Warn on demand on pad with eos
Browse files Browse the repository at this point in the history
  • Loading branch information
FelonEkonom committed Aug 9, 2024
1 parent 8d2de6b commit 81d7535
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog

## 1.1.2
* Remove 'failed to insert a metric' stalker warning [#849](https://github.com/membraneframework/membrane_core/pull/849)
* Remove 'failed to insert a metric' stalker warning [#849](https://github.com/membraneframework/membrane_core/pull/849)

## 1.1.1
* Fix 'table identifier does not refer to an existing ETS table' error when inserting metrics into the observability ETS. [#835](https://github.com/membraneframework/membrane_core/pull/835)
Expand Down
16 changes: 15 additions & 1 deletion lib/membrane/core/element/action_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,12 @@ defmodule Membrane.Core.Element.ActionHandler do
@impl CallbackHandler
def handle_action(
{:demand, {pad_ref, size}},
_cb,
cb,
_params,
%State{type: type} = state
)
when is_pad_ref(pad_ref) and is_demand_size(size) and type in [:sink, :filter, :endpoint] do
:ok = maybe_warn_on_demand_action(pad_ref, size, cb, state)
delay_supplying_demand(pad_ref, size, state)
end

Expand Down Expand Up @@ -481,4 +482,17 @@ defmodule Membrane.Core.Element.ActionHandler do
end

defp handle_outgoing_event(_pad_ref, _event, state), do: state

defp maybe_warn_on_demand_action(pad_ref, demand_size, callback, state) do
if PadModel.get_data!(state, pad_ref, :end_of_stream?) do
Membrane.Logger.warning("""
Action :demand with value #{inspect(demand_size)} for pad #{inspect(pad_ref)} was returned \
from callback #{inspect(callback)}, but stream on this pad has already ended, callback \
c:handle_end_of_stream/3 for this pad has been called and no more buffers will arrive on \
this pad.
""")
end

:ok
end
end

0 comments on commit 81d7535

Please sign in to comment.