-
Notifications
You must be signed in to change notification settings - Fork 36
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
Refactor process_own_message to not mutate intent state directly #985
Refactor process_own_message to not mutate intent state directly #985
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
51dbd6e
to
38f29c6
Compare
4ffa958
to
9bc52b9
Compare
38f29c6
to
d8dd680
Compare
9bc52b9
to
18f59d8
Compare
d8dd680
to
492e673
Compare
18f59d8
to
03677ae
Compare
492e673
to
58bbcd2
Compare
03677ae
to
c2a3bd8
Compare
58bbcd2
to
5902193
Compare
c2a3bd8
to
a01133c
Compare
5902193
to
0e1c68f
Compare
a01133c
to
2cec1d2
Compare
0e1c68f
to
2c6cb9e
Compare
2cec1d2
to
c855664
Compare
2c6cb9e
to
1e535db
Compare
c855664
to
89c3113
Compare
1e535db
to
5d277d6
Compare
89c3113
to
cb49a01
Compare
5d277d6
to
c9f0f10
Compare
cb49a01
to
3492510
Compare
3492510
to
5afdbc3
Compare
@@ -345,7 +343,7 @@ impl MlsGroup { | |||
); | |||
if let Err(err) = openmls_group.merge_staged_commit(&provider, pending_commit) { | |||
log::error!("error merging commit: {}", err); | |||
conn.set_group_intent_to_publish(intent.id)?; |
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.
Interesting, I wonder if this was a bug before? In the previous code it would have continued to L371 and set it to committed
Ok(provider.conn_ref().set_group_intent_committed(intent_id)?) | ||
} | ||
IntentState::Published => { | ||
log::warn!("Unexpected behaviour: returned intent state published from process_own_message"); |
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.
For unexpected behavior, I think we should log errors, so that we are more likely to see them. Especially if we choose not to update the state here
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.
The problem is that we aren't returning the error in a lot of cases. We only return the error if we want to hard fail without changing the intent status (like a DB connection error). That'll get returned to the calling function, which does log it.
So, we have to log inside process_own_message
before returning OK
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.
What I meant is, as a general rule, we should do log::error
instead of log::warn
for cases we expect never to happen - not that we need to return an error to the caller
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.
Ahh, I see. I can update that
tl;dr
process_own_message
to return the desired intent state, instead of having a bunch of DB operations happen in the method