Skip to content

Commit

Permalink
refactor: remove extra key presence check
Browse files Browse the repository at this point in the history
  • Loading branch information
BorysTheDev committed Dec 27, 2023
1 parent 266f7a9 commit 54b891b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
8 changes: 0 additions & 8 deletions src/server/blocking_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,6 @@ void BlockingController::NotifyPending() {
for (auto key : wt.awakened_keys) {
string_view sv_key = static_cast<string_view>(key);
DVLOG(1) << "Processing awakened key " << sv_key;

// Double verify we still got the item.
auto [it, exp_it] = owner_->db_slice().FindReadOnly(context, sv_key);
// Only LIST, ZSET and STREAM are allowed to block.
if (!IsValid(it) || !(it->second.ObjType() == OBJ_LIST || it->second.ObjType() == OBJ_ZSET ||
it->second.ObjType() == OBJ_STREAM))
continue;

NotifyWatchQueue(sv_key, &wt.queue_map, context);
}
wt.awakened_keys.clear();
Expand Down
11 changes: 1 addition & 10 deletions src/server/stream_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,7 @@ TEST_F(StreamFamilyTest, XReadGroupBlock) {

fb0.Join();
fb1.Join();
// temporary incorrect results
// if (resp0.GetVec()[1].GetVec().size() == 0) {
// EXPECT_THAT(resp0.GetVec(), ElementsAre("foo", ArrLen(0)));
// EXPECT_THAT(resp1.GetVec(), ElementsAre("foo", ArrLen(1)));
// } else {
// EXPECT_THAT(resp0.GetVec(), ElementsAre("foo", ArrLen(1)));
// EXPECT_THAT(resp1.GetVec(), ElementsAre("foo", ArrLen(0)));
// }

// correct results

if (resp0.GetVec()[0].GetString() == "foo") {
EXPECT_THAT(resp0.GetVec(), ElementsAre("foo", ArrLen(1)));
EXPECT_THAT(resp1.GetVec(), ElementsAre("bar", ArrLen(1)));
Expand Down

0 comments on commit 54b891b

Please sign in to comment.