Skip to content

Commit

Permalink
tweak: Log on trip mod publication (#2951)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahpurcell authored Feb 6, 2025
1 parent 4c180c1 commit 848bd65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/skate/detours/trip_modification_publisher.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
defmodule Skate.Detours.TripModificationPublisher do
@behaviour Skate.Detours.TripModificationPublisher
require Logger

@moduledoc """
Connects to the MQTT Broker, then allows sending `Realtime.TripModification`'s
to the Broker.
Expand Down Expand Up @@ -152,9 +154,12 @@ defmodule Skate.Detours.TripModificationPublisher do
# Send at least once
qos: 1
}) do
Logger.info(fn -> "publish_modification: message successfully sent" end)
:ok
else
res -> res
{:error, error} ->
Logger.warning(fn -> "publish_modification returned error: #{error}" end)
{:error, error}
end

{
Expand Down
5 changes: 4 additions & 1 deletion lib/skate_web/controllers/detours_controller.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule SkateWeb.DetoursController do
require Logger
alias Realtime.Shape
alias Realtime.TripModification
alias Skate.OpenRouteServiceAPI
Expand Down Expand Up @@ -125,7 +126,9 @@ defmodule SkateWeb.DetoursController do
trip_modification_publisher().publish_modification(modification, shape, is_draft?: true)
catch
# May throw if the publishing server doesn't exist, which we can ignore.
:exit, {:noproc, _} -> nil
:exit, {:noproc, _} ->
Logger.warning(fn -> "trip_modification_publisher: Publishing server not found" end)
nil
end
end

Expand Down

0 comments on commit 848bd65

Please sign in to comment.