Skip to content

Conversation

apron-manlike0o
Copy link

Directly addresses issue #2729.

On error, the database_update is created by a default pattern which always produces a request_id of None.
However the event struct holds the true request_id, hence it should prioritize that request_id value.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


tty0 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment on lines +283 to +284
let mut request_id = database_update.request_id.unwrap_or(0);
request_id = event.clone().map_or(request_id, |e| e.request_id.unwrap_or(request_id));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let mut request_id = database_update.request_id.unwrap_or(0);
request_id = event.clone().map_or(request_id, |e| e.request_id.unwrap_or(request_id));
let request_id = database_update.request_id
.or_else(|| event.as_ref().map(|event| event.request_id)
.unwrap_or(0);

No need to clone the event, and a functional style with Option combinators is better here than mutation.

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.

3 participants