-
Notifications
You must be signed in to change notification settings - Fork 221
Add ActiveRoomHolder
to manage the active room for a session
#4758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
This allows us to reuse these rooms for several actions that would otherwise create a new instance of the room, which, if the room is already available, would cause delays of several seconds since the live timeline can take a while to restore if it contains many events.
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4758 +/- ##
===========================================
- Coverage 80.32% 80.32% -0.01%
===========================================
Files 2127 2128 +1
Lines 56319 56348 +29
Branches 7055 7067 +12
===========================================
+ Hits 45241 45263 +22
+ Misses 8661 8659 -2
- Partials 2417 2426 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks
class ActiveRoomHolder @Inject constructor() { | ||
private val rooms = ConcurrentHashMap<SessionId, JoinedRoom>() | ||
|
||
fun addRoom(room: JoinedRoom) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change to setRoom
? Or store a Stack of rooms to fix the issue with permalink?
fun removeRoom(sessionId: SessionId): JoinedRoom? { | ||
return rooms.remove(sessionId) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe create an extension like
fun ActiveRoomHolder.getActiveRoomIf(sessionId: SessionId, roomId: RoomId): JoinedRoom? {
return getActiveRoom(sessionId)?.takeIf { it.roomId == roomId }
}
@@ -95,6 +98,7 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor( | |||
}, | |||
onDestroy = { | |||
Timber.v("OnDestroy") | |||
activeRoomHolder.removeRoom(inputs.room.sessionId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work well with permalink. If a room A opens a room B, when going back to room A, the holder will be empty.
86da4f7
to
f7549de
Compare
|
Content
What the title says
Motivation and context
This allows us to reuse these rooms for several actions that would otherwise create a new instance of the room, which, if the room is already available, would cause delays of several seconds since the live timeline can take a while to restore if it contains many events.
Tests
These actions should be noticeably faster:
Tested devices
Checklist