Skip to content

Commit

Permalink
[ISSUE #2087]🐛Fix ReferenceResource#hold not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm committed Jan 4, 2025
1 parent 2cd44af commit 3506b60
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,10 @@ impl ReferenceResource {
#[inline]
pub fn hold(&self) -> bool {
if self.is_available() {
if self.ref_count.fetch_add(1, Ordering::Relaxed) + 1 > 0 {
if self.ref_count.fetch_add(1, Ordering::SeqCst) > 0 {

Check warning on line 812 in rocketmq-store/src/log_file/mapped_file/default_mapped_file_impl.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-store/src/log_file/mapped_file/default_mapped_file_impl.rs#L812

Added line #L812 was not covered by tests
return true;
} else {
self.ref_count.fetch_sub(1, Ordering::Relaxed);
self.ref_count.fetch_sub(1, Ordering::SeqCst);

Check warning on line 815 in rocketmq-store/src/log_file/mapped_file/default_mapped_file_impl.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-store/src/log_file/mapped_file/default_mapped_file_impl.rs#L815

Added line #L815 was not covered by tests
}
}
false
Expand Down

0 comments on commit 3506b60

Please # to comment.