Skip to content

[RTC-456] Add peerless room purge#150

Merged
sgfn merged 8 commits intomainfrom
sgfn/RTC-385-autodelete-rooms
Feb 15, 2024
Merged

[RTC-456] Add peerless room purge#150
sgfn merged 8 commits intomainfrom
sgfn/RTC-385-autodelete-rooms

Conversation

@sgfn
Copy link
Copy Markdown
Member

@sgfn sgfn commented Feb 7, 2024

Acknowledging the stipulations set forth:

  • I hereby confirm that a Pull Request involving updates to the Software Development Kit (SDK) has been smoothly merged, currently awaits processing, or is otherwise deemed unnecessary in this context.
  • I also affirm that another Pull Request, specifically addressing updates to the documentation body (commonly referred to as 'docs'), has either been successfully incorporated, is in the process of review, or is considered superfluous under the prevailing circumstances.

@sgfn sgfn requested review from Rados13 and mickel8 February 7, 2024 13:33
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2024

Codecov Report

Merging #150 (fcc81f0) into main (6b61fc4) will decrease coverage by 0.04%.
The diff coverage is 92.59%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
- Coverage   86.87%   86.84%   -0.04%     
==========================================
  Files          64       64              
  Lines        1227     1247      +20     
==========================================
+ Hits         1066     1083      +17     
- Misses        161      164       +3     
Files Coverage Δ
lib/jellyfish/component/file.ex 100.00% <100.00%> (ø)
lib/jellyfish/room/config.ex 96.15% <100.00%> (+0.69%) ⬆️
lib/jellyfish_web/api_spec/room.ex 100.00% <ø> (ø)
lib/jellyfish_web/controllers/room_controller.ex 100.00% <100.00%> (ø)
test/support/webhook_plug.ex 100.00% <100.00%> (ø)
lib/jellyfish/room.ex 80.67% <86.66%> (-0.22%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b61fc4...fcc81f0. Read the comment docs.

Comment on lines -121 to -135
test "renders room when max_peers isn't present", %{conn: conn} do
conn = post(conn, ~p"/room")
assert %{"id" => id} = json_response(conn, :created)["data"]["room"]

conn = get(conn, ~p"/room/#{id}")
response = json_response(conn, :ok)
assert_response_schema(response, "RoomDetailsResponse", @schema)

assert %{
"id" => ^id,
"config" => %{},
"components" => [],
"peers" => []
} = response["data"]
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't add anything of value, the checks performed here are already done in "renders room when data is valid" and "renders room when data is valid, custom room_id"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Practically speaking, yes; philosophically, no. It is not the responsibility of these tests to verify that action X occurs, especially if it's not mentioned in their names. However, it is easy to accidentally refactor these tests and unintentionally remove coverage for this edge case. If you insist on removing this test, I suggest adding a note to one of the other tests indicating that it also covers the situation previously handled by the removed test.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated name of test

Comment thread lib/jellyfish/room.ex
"Removing room because it was peerless for #{state.config.peerless_purge_timeout} seconds"
)

{:stop, :normal, state}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stopping with normal won't cause other processes that are linked to the room process to exit. I am not sure if that's correct. I think I would go for {:shutdown, :peerless_purge}? See https://hexdocs.pm/elixir/1.16.0/Supervisor.html#module-exit-reasons-and-restarts

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's exactly how RoomService removes rooms -- here

We're manually removing all of the linked processes in the terminate callback, no?

Comment thread test/jellyfish/room_test.exs Outdated
Comment on lines -121 to -135
test "renders room when max_peers isn't present", %{conn: conn} do
conn = post(conn, ~p"/room")
assert %{"id" => id} = json_response(conn, :created)["data"]["room"]

conn = get(conn, ~p"/room/#{id}")
response = json_response(conn, :ok)
assert_response_schema(response, "RoomDetailsResponse", @schema)

assert %{
"id" => ^id,
"config" => %{},
"components" => [],
"peers" => []
} = response["data"]
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Practically speaking, yes; philosophically, no. It is not the responsibility of these tests to verify that action X occurs, especially if it's not mentioned in their names. However, it is easy to accidentally refactor these tests and unintentionally remove coverage for this edge case. If you insist on removing this test, I suggest adding a note to one of the other tests indicating that it also covers the situation previously handled by the removed test.

@sgfn sgfn changed the title [RTC-385] Add peerless room purge [RTC-456] Add peerless room purge Feb 12, 2024
@sgfn
Copy link
Copy Markdown
Member Author

sgfn commented Feb 14, 2024

Bumped Elixir to 1.15 because we use Map.intersect which was added in that version

EDIT: disregard, restored 1.14 because test_load_balancing uses 1.14. Removed calls to Map.intersect instead

@sgfn sgfn requested a review from mickel8 February 14, 2024 14:27
@sgfn sgfn force-pushed the sgfn/RTC-385-autodelete-rooms branch from 171c5fa to 9262b6c Compare February 14, 2024 14:44
@sgfn sgfn merged commit 090a338 into main Feb 15, 2024
@sgfn sgfn deleted the sgfn/RTC-385-autodelete-rooms branch February 15, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants