Skip to content

Commit 9cfc3e0

Browse files
Rados13roznawsk
andauthored
RTC-512 Add Room.State module and peer disconnected timeout (#178)
* Add Room.State module * WiP * OpenApi changes * Fix test * Update type * Fix type of peer * Send RoomDeleted after peerlessPurge * Fix tests * Update lib/jellyfish_web/api_spec/room.ex Co-authored-by: Przemysław Rożnawski <48837433+roznawsk@users.noreply.github.com> * Move Event.broadcast_server_notification to State module and telemetry.execute * Update openapi spec * Add logs in peer_socket.ex * Add peer_id metadata in logger --------- Co-authored-by: Przemysław Rożnawski <48837433+roznawsk@users.noreply.github.com>
1 parent 67bf454 commit 9cfc3e0

File tree

14 files changed

+818
-383
lines changed

14 files changed

+818
-383
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.lexical/*
12
compile_commands.json
23
.gdb_history
34
bundlex.sh

config/config.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ config :membrane_telemetry_metrics, enabled: true
1717

1818
config :logger, :console,
1919
format: "$time $metadata[$level] $message\n",
20-
metadata: [:request_id, :room_id]
20+
metadata: [:request_id, :room_id, :peer_id]
2121

2222
config :logger_json, :backend,
2323
metadata: [:request_id, :room_id],

lib/jellyfish/peer.ex

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ defmodule Jellyfish.Peer do
1313
:type,
1414
:engine_endpoint
1515
]
16-
defstruct @enforce_keys ++ [status: :disconnected, socket_pid: nil, tracks: %{}, metadata: nil]
16+
defstruct @enforce_keys ++
17+
[
18+
status: :disconnected,
19+
socket_pid: nil,
20+
tracks: %{},
21+
metadata: nil,
22+
last_time_connected: nil
23+
]
1724

1825
@type id :: String.t()
1926
@type peer :: WebRTC
@@ -32,7 +39,8 @@ defmodule Jellyfish.Peer do
3239
socket_pid: pid() | nil,
3340
engine_endpoint: Membrane.ChildrenSpec.child_definition(),
3441
tracks: %{Track.id() => Track.t()},
35-
metadata: any()
42+
metadata: any(),
43+
last_time_connected: integer() | nil
3644
}
3745

3846
@spec parse_type(String.t()) :: {:ok, peer()} | {:error, :invalid_type}

0 commit comments

Comments
 (0)