Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Impl do
Queries.set_device_connected!(
new_state.realm,
new_state.device_id,
DateTime.from_unix!(timestamp_ms, :microsecond),
DateTime.from_unix!(timestamp_ms, :millisecond),
ip_address
)

Expand Down Expand Up @@ -2244,7 +2244,7 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Impl do
Queries.set_device_disconnected!(
state.realm,
state.device_id,
DateTime.from_unix!(timestamp_ms, :microsecond),
DateTime.from_unix!(timestamp_ms, :millisecond),
state.total_received_msgs,
state.total_received_bytes,
state.interface_exchanged_msgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Queries do

defp set_connection_info!(realm, device_id, timestamp, ip_address) do
keyspace_name = Realm.keyspace_name(realm)
timestamp = Ecto.Type.cast!(:utc_datetime_usec, timestamp)

%Device{device_id: device_id}
|> Ecto.Changeset.change(
Expand Down Expand Up @@ -515,6 +516,7 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Queries do
interface_exchanged_bytes
) do
keyspace_name = Realm.keyspace_name(realm)
timestamp_ms = Ecto.Type.cast!(:utc_datetime_usec, timestamp_ms)

%Device{device_id: device_id}
|> Ecto.Changeset.change(
Expand Down
Loading