Skip to content

Conversation

@bmarty
Copy link
Member

@bmarty bmarty commented Apr 25, 2022

Draft for a hotfix

@bmarty bmarty requested review from BillCarsonFr and ganfra April 25, 2022 14:12
}
.execute { async ->
val rootSpaces = session.spaceService().getRootSpaceSummaries()
val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
Copy link
Member Author

Choose a reason for hiding this comment

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

On my side this is equivalent, but I do not have any spaces with child space. I will create some

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, it works as expected

@github-actions
Copy link

github-actions bot commented Apr 25, 2022

Unit Test Results

114 files  ±0  114 suites  ±0   1m 18s ⏱️ -15s
202 tests ±0  202 ✔️ ±0  0 💤 ±0  0 ±0 
678 runs  ±0  678 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit c542619. ± Comparison against base commit a521824.

♻️ This comment has been updated with latest results.

.getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER))
.asFlow()
) { _, communityGroups, _ ->
communityGroups
Copy link
Member

Choose a reason for hiding this comment

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

should rename this to spaceList

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, but I wanted to limit the number of changes for the hotfix

Copy link
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

LGTM, it's fixing freeze issues on my side

override fun getRootSpaceSummaries(): List<RoomSummary> {
return roomSummaryDataSource.getRootSpaceSummaries()
override suspend fun getRootSpaceSummaries(): List<RoomSummary> {
return withContext(coroutineDispatchers.io) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

not for this PR as it would introduce lots of changes, but worth highlighting in case we want guard against other cases

from my understanding the general approach of coroutines scoping is to define the context switching at the lowest possible level, which in this case would be

monarchy.fetchAllMappedSync

we already have a similar wrapper for awaitTransaction

this would also force non coroutine based usages to rely on runBlocking, which would have the benefit of make finding the usages a bit easier

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, good point!

Copy link
Member

Choose a reason for hiding this comment

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

Actually we might want to dispatch querying db to a background thread, to avoid blocking the dispatcher, as Retrofit does for request (and probably Room)

Comment on lines +284 to -295
session.accountDataService()
.getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER))
.asFlow()
) { _, communityGroups, _ ->
Copy link
Contributor

Choose a reason for hiding this comment

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

to double check, were the other flows being used as some sort of predicate? / Do we need .getLiveRoomAccountDataEvents(...).asFlow()

it's a bit strange to see us submit flows to combine and then ignore their result 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

It's true that we ignore the result, but we want to be notified when the account data EVENT_TYPE_SPACE_ORDER is updated.

val rootSpaces = session.spaceService().getRootSpaceSummaries()
val orders = rootSpaces.map {
val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
val orders = rootSpaces.associate {
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

@ouchadam ouchadam left a comment

Choose a reason for hiding this comment

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

from the fix perspective LGTM! 💯 should this PR point to main ?

@bmarty bmarty merged commit d4c0575 into develop Apr 26, 2022
@bmarty bmarty deleted the hotfix/1.4.13 branch April 26, 2022 09:50
@bmarty
Copy link
Member Author

bmarty commented Apr 26, 2022

The PR could have pointed to main, but it was not aimed to be merged from GH interface. We use gitflow, which will merge this branch on main and on develop

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.

6 participants