mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
fix(DenseSet): Rename Size()
to UpperBoundSize()
and add SizeSlow()
(#2130)
Then use the right version (hopefully) in the right places. Specifically, this fixes a serialization bug, where we could send malformed responses when using `UpperBoundSize()` to write array length.
This commit is contained in:
parent
f809fb04bc
commit
7e23c14c35
12 changed files with 48 additions and 41 deletions
|
@ -671,4 +671,17 @@ bool DenseSet::ExpireIfNeededInternal(DensePtr* prev, DensePtr* node) const {
|
|||
return deleted;
|
||||
}
|
||||
|
||||
void DenseSet::CollectExpired() {
|
||||
// Simply iterating over all items will remove expired
|
||||
auto it = IteratorBase(this, false);
|
||||
while (it.curr_entry_ != nullptr) {
|
||||
it.Advance();
|
||||
}
|
||||
}
|
||||
|
||||
size_t DenseSet::SizeSlow() {
|
||||
CollectExpired();
|
||||
return size_;
|
||||
}
|
||||
|
||||
} // namespace dfly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue