Skip to content

Commit

Permalink
kvector最后一条请求不更改resp的状态
Browse files Browse the repository at this point in the history
  • Loading branch information
parabala committed May 23, 2024
1 parent 1feaab3 commit 5c0f9f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions protocol/src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ impl CallbackContext {
None => resp.ok(),
Some(ref attach) => parser.queried_enough_responses(attach),
};
if resp.ok() && !attach_ok {
resp.update_ok(false);
}
// 响应数量或者请求次数达预期,不再继续请求了,适用kvector场景,先打通
if attach_ok || self.tries.load(Relaxed) == (self.max_tries - 1) {
self.set_last();
}
if resp.ok() && !self.last() {
resp.update_ok(false);
}

self.resp_count += resp.count();
self.swap_response(resp);
Expand Down
2 changes: 2 additions & 0 deletions protocol/src/vector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ impl Protocol for Vector {
// 1. 只返回影响的行数
// 2. 一行或多行数据
// 3. 结果为空
w.write(format!("*2\r\n").as_bytes())?;
w.write(response.header.header.as_ref())?;
w.write_slice(response, 0)?; // value
}
return Ok(());
Expand Down

0 comments on commit 5c0f9f3

Please sign in to comment.