Skip to content
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

Fixed a few issues with the OpenGroupPoller #1241

Merged
merged 2 commits into from
Jun 8, 2023

Conversation

mpretty-cyro
Copy link
Collaborator

  • Fixed an issue where the admin/moderator status wasn't getting stored if set before joining a community
  • Fixed an issue where multiple pollers for the same server could run at the same time when joining multiple rooms within the same app run (very noticeable when restoring/linking)

Fixed an issue where the admin/moderator status wasn't getting stored if set before joining a community
Fixed an issue where multiple pollers for the same server could run at the same time when joining multiple rooms within the same app run (very noticeable when restoring/linking)
@mpretty-cyro mpretty-cyro added the bug Something isn't working label Jun 7, 2023
@mpretty-cyro mpretty-cyro self-assigned this Jun 7, 2023
Copy link

@bemusementpark bemusementpark left a comment

Choose a reason for hiding this comment

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

possibly needs synchronization on runId.

@@ -41,11 +41,13 @@ object OpenGroupManager {
isPolling = true
val storage = MessagingModuleConfiguration.shared.storage
val servers = storage.getAllOpenGroups().values.map { it.server }.toSet()

Choose a reason for hiding this comment

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

useless .toSet()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So the conversion to Set<T> is in order to remove duplicates from the collection - getAllOpenGroups() returns every community you are a member of, so if you are in multiple rooms on the same server (eg. Session, Oxen, Session Updates all on the getsession.org server) the result would have 3 entries for getsession.org

The poll request actually makes a single /batch API call to the server which includes a call for each room on that server (so without the toSet() the forEach loop would end up redundantly initialising and triggering a poll for each copy of the server)

Choose a reason for hiding this comment

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

ohhh... cool.

}.fail {
updateCapabilitiesIfNeeded(isPostCapabilitiesRetry, it)
updateCapabilitiesIfNeeded(isPostCapabilitiesRetry, currentRunId, it)
}.map { }

Choose a reason for hiding this comment

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

useless map{}, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The map was there to convert the return value from Promise<List<OpenGroupApi.BatchResponse<*>>, Exception> to Promise<Unit, Exception>

@mpretty-cyro mpretty-cyro merged commit a957e78 into oxen-io:dev Jun 8, 2023
@mpretty-cyro mpretty-cyro deleted the fix/open-group-polling-bugs branch June 8, 2023 06:53
@mpretty-cyro mpretty-cyro mentioned this pull request Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants