From e4f0cb976705697d9d8db25d6bbdc06a88c3a070 Mon Sep 17 00:00:00 2001 From: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com> Date: Mon, 27 Sep 2021 19:17:48 +0200 Subject: [PATCH] Unify wording --- lib/teslamate/vehicles/vehicle.ex | 6 +++--- test/teslamate/vehicles/vehicle/streaming_test.exs | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/teslamate/vehicles/vehicle.ex b/lib/teslamate/vehicles/vehicle.ex index 2100124d..807e0cf1 100644 --- a/lib/teslamate/vehicles/vehicle.ex +++ b/lib/teslamate/vehicles/vehicle.ex @@ -276,7 +276,7 @@ defmodule TeslaMate.Vehicles.Vehicle do drive_states = %{now: vehicle.drive_state, last: data.last_response.drive_state} Logger.warning( - "Discarded outdated fetch result: #{inspect(drive_states, pretty: true)}", + "Discarded stale fetch result: #{inspect(drive_states, pretty: true)}", car_id: data.car.id ) @@ -397,10 +397,10 @@ defmodule TeslaMate.Vehicles.Vehicle do _ -> nil end - outdated_stream_data? = t0 != nil and DateTime.compare(t0, stream_data.time) == :gt + stale_stream_data? = t0 != nil and DateTime.compare(t0, stream_data.time) == :gt case stream_data do - %Stream.Data{} when outdated_stream_data? -> + %Stream.Data{} when stale_stream_data? -> Logger.warn("Received stale stream data: #{inspect(stream_data)}", car_id: data.car.id) :keep_state_and_data diff --git a/test/teslamate/vehicles/vehicle/streaming_test.exs b/test/teslamate/vehicles/vehicle/streaming_test.exs index d19699cf..4b0c0410 100644 --- a/test/teslamate/vehicles/vehicle/streaming_test.exs +++ b/test/teslamate/vehicles/vehicle/streaming_test.exs @@ -234,7 +234,7 @@ defmodule TeslaMate.Vehicles.Vehicle.StreamingTest do assert_receive :continue? refute_receive _ end) =~ """ - [warn] Discarded outdated fetch result: %{ + [warn] Discarded stale fetch result: %{ last: %TeslaApi.Vehicle.State.Drive{ gps_as_of: nil, heading: 120, @@ -281,11 +281,10 @@ defmodule TeslaMate.Vehicles.Vehicle.StreamingTest do @tag :capture_log test "discards stale stream data", %{test: name} do now = DateTime.utc_now() - now_ts = DateTime.to_unix(now, :millisecond) events = [ {:ok, online_event()}, - {:ok, online_event(drive_state: %{timestamp: now_ts})}, + {:ok, online_event(drive_state: %{timestamp: DateTime.to_unix(now, :millisecond)})}, fn -> Process.sleep(10_000) end ]