-
Notifications
You must be signed in to change notification settings - Fork 242
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
Community members reevaluation fixes #5117
Conversation
Jenkins BuildsClick to see older builds (17)
|
7aedfc1
to
899ae54
Compare
Looks like I fixed my test and broke a few others 😄 |
I made the condition a bit more lenient: allow publishing community with same clock as last sent: diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go
index d803e0b4d..bc3ba7caf 100644
--- a/protocol/messenger_communities.go
+++ b/protocol/messenger_communities.go
@@ -291,7 +288,7 @@ func (m *Messenger) handleCommunitiesSubscription(c chan *communities.Subscripti
publishOrgAndDistributeEncryptionKeys := func(community *communities.Community) {
recentlyPublishedOrg := recentlyPublishedOrgs[community.IDString()]
- if recentlyPublishedOrg != nil && community.Clock() <= recentlyPublishedOrg.Clock() {
+ if recentlyPublishedOrg != nil && community.Clock() < recentlyPublishedOrg.Clock() {
return
} This fixes (at least makes same as before) I'm not sure if it's the right thing to do. |
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.
LGTM, though I'm not an expert on that part of the code
Thanks @igor-sirotin for fixes and cleanup 👍
Your guess seems correct. We should not publish same community twice.
That should not be the case. Keys should be attached already with first publish. I created issue to investigate that deeper: #5149 |
Tip
Review by commits
Load community from the database inside
ReevaluateMembers
, instead of passing as argument.To ensure that the community is loaded and saved while
m.communityLock
is locked.Made
ReevaluateCommunityMembersPermissions
a private func.To ensure that it's only called inside the members reevaluation loop.
Where it was called directly, we now call
ScheduleMembersReevaluation
.Created a public
StartMembersReevaluationLoop
and madeReevaluateMembersPeriodically
a private func.To ensure
ReevaluateMembersPeriodically
is started as a separate goroutine and make the code simpler.StartMembersReevaluationLoop
has a boolean argumentreevaluateOnStart
.When
true
, members reevaluation is forced once on the loop start, which is same as current behaviour.Prevent publishing older community description in
publishOrgAndDistributeEncryptionKeys
Required for #5076