Skip to content

Commit

Permalink
Fix intermittent tests
Browse files Browse the repository at this point in the history
Forcing to always compile does the trick. But I really don't know why
yet.
  • Loading branch information
philss committed Jun 28, 2023
1 parent 0036a77 commit c1b97a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/support/broadway_support.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ defmodule BroadwayDashboard.BroadwaySupport do
defmodule Forwarder do
use Broadway

@impl true
def handle_message(:default, message, %{test_pid: test_pid}) do
send(test_pid, {:message_handled, message.data})
message
end

@impl true
def handle_batch(batcher, messages, _, %{test_pid: test_pid}) do
send(test_pid, {:batch_handled, batcher, messages})
messages
Expand All @@ -16,6 +18,11 @@ defmodule BroadwayDashboard.BroadwaySupport do
defmodule ForwarderViaName do
use Broadway

# For some reason, this module needs to always be compiled in order
# to see the "process_name/2" function implemented.
# TODO: investigate
def __mix_recompile__?(), do: true

def process_name({:via, registry, {registry_name, name}}, base_name) do
{:via, registry, {registry_name, {name, base_name}}}
end
Expand Down

0 comments on commit c1b97a4

Please sign in to comment.