-
Notifications
You must be signed in to change notification settings - Fork 100
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
Fix removing payment from in-memory store #514
Conversation
👋 Thanks for assigning @tnull as a reviewer! |
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.
Ah good catch indeed!
Please make these changes two commits though, and provide proper commit descriptions for both.
src/payment/store.rs
Outdated
log_error!( | ||
self.logger, | ||
"Removing payment data for key {}/{}/{} failed due to: {}", | ||
if self.payments.lock().unwrap().remove(id).is_some() { |
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.
Please introduce a variable for this, especially since it would allow us to drop the lock again before the KVStore
IO operation.
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.
Done.
src/payment/store.rs
Outdated
.filter(f) | ||
.cloned() | ||
.collect::<Vec<PaymentDetails>>() | ||
self.payments.lock().unwrap().values().filter(f).cloned().collect() |
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.
I guess, but please make this a separate commit.
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.
Done.
src/payment/store.rs
Outdated
@@ -712,8 +708,7 @@ where | |||
e | |||
); | |||
Error::PersistenceFailed | |||
})?; | |||
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.
No, please revert this.
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.
Done.
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
2541f65
to
c32b646
Compare
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, thanks!
I all other places
self.payments
state is synchronized withself.kv_store
. I guess here it should be as well, no?